现象
ssh li@192.168.237.133
Permission denied,please try again(Publickey,Password)
解决办法
vi /etc/ssh/sshd_config
PermitRootLogin yes
PubkeyAuthentication no
PasswordAuthentication yes
sudo service sshd restart
#或者
systemctl restart sshd
我遇到的坑
1.错把ssh 用户名@远程主机IP地址
用户名写成主机名
2.ssh远程连接时,需要将此用户设成管理员权限
vi /etc/sudoers
#在合适的位置添加
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
%li ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
%li ALL=(ALL:ALL) ALL