Ubuntu系统root用户远程登录

时间:2023-02-09 08:01:56

 通过CRT远程登录Ubuntu时遇到报错:

The client has disconnected from the server.  Reason:

Unable to authenticate using any of the configured authentication methods.  

Ubuntu初始登录只能是普通用户,想用root登录,需普通用户登录,然后切换为root用户,先设置root密码,再更改sshd_config文件

ixo@snort:~$ sudo su
Password:
root@snort:/home/ixo#sudo passwd root
New password:
Retype new password:
passwd: password updated successfully
root@snort:/home/ivo# nano /etc/ssh/sshd_config

注意:是sshd_config,而不是ssh_config

...
#port 22
port 22
#PermitRootLogin prohibit-password
PermitRootLogin yes # 允许root直接登录
...

保存后重启ssh服务

sudo service ssh restart