ubuntu 18.04使用root用户登录ssh

ubuntu系统默认root用户是不能登录的,密码也是空的。

如果要使用root用户登录,必须先为root用户设置密码

打开终端,输入:sudo passwd root 然后按回车

此时会提示你输入密码,在password:后输入你现在登录的用户的密码

在ubuntu系统中,默认是不开启ssh使用root用户登陆的,在/etc/ssh/sshd_config配置文件中如下配置:

# Authentication:

#PermitRootLogin without-password

将PermitRootLogin without-password注释取消,并修改为PermitRootLogin yes.

然后重启ssh,sudo service ssh restart.这样就可以使用root用户登陆了

评论

暂无评论