Ubuntu 或 Raspbian 系统默认不允许root 用户以ssh方式连接。连接会报如下错误:
Permission denied, please try again.
解决步骤:
(如果是树莓派系统:烧录到内存卡后,拔掉内存卡再重新插到PC机上,在根目录建一个名称为SSH的文件,然后再插入树莓派主板,上电启动系统。然后做如下操作)
第一步:将 /etc/ssh/sshd_config 文件中如下行:
#PermitRootLogin prohibit-password
修改为:
PermitRootLogin yes
第二步:重启ssh服务
systemctl restart ssh 或 systemctl restart sshd
第三步:修改root密码
root@ubuntu:~# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@ubuntu:~#
第五步:重新以root用户ssh方式连接Ubuntu