Ubuntu 20.04 Install SSH, Change SSH Port, Enable root

Posted 遠離塵世の方舟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 20.04 Install SSH, Change SSH Port, Enable root相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu20.04启用SSH

VS Code Jest 在 Ubuntu 20.04 上启动失败(ubuntu-make install)

Ubuntu20.04 允许root SSH 登录

ubuntu20.04如何启用ssh?如何通过sftp连接pycharm?

How to Install & Configure VNC Server on Ubuntu 22.04 or 20.04

如何在 Ubuntu 20.04 上安装启用 SSH