码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu 20.04 Install SSH, Change SSH Port, Enable root

时间:2020-08-02 19:56:16      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:serve   sudo   passwd   roo   openssh   miss   open   str   admin   

1. Install SSH service

$ sudo apt install openssh-server
$ systemctl status sshd
$ sudo systemctl restart ssh
$ sudo ufw allow ssh
$ sudo systemctl enable ssh

2.Change default SSH port 22 to some other port number above 1024. 

To do so edit the /etc/ssh/sshd_config
Port 8888

$ sudo ufw allow 8888/tcp 

$ sudo systemctl restart ssh

3. Enable root access SSH
Open the /etc/ssh/sshd_config file with administrative privileges and change the following line:
FROM:
#PermitRootLogin prohibit-password
TO:
PermitRootLogin yes

$ sudo systemctl restart ssh

4. Enable root account

By default the root‘s password is not set on Ubuntu 20.04 and the error message Permission denied, please try again will appear when attempting to SSH login as a root user. From this reason we need to set root‘s password. When prompted enter your current user password followed by new root password:
$ sudo passwd
[sudo] password for rusking:
New password:
Retype new password:
passwd: password updated successfully

 

Ubuntu 20.04 Install SSH, Change SSH Port, Enable root

标签:serve   sudo   passwd   roo   openssh   miss   open   str   admin   

原文地址:https://www.cnblogs.com/rusking/p/13420060.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!