xshell连接Ubuntu服务器总提示密码输入错误,应该是默认禁止了root远程登陆,需要修改ssh配置文件。
1.确认sshserver是否启动了
ps -e | grep ssh
如果只有ssh-agent那ssh-server还没有启动,需要/etc/init.d/ssh start,如果看到sshd那说明ssh-server已经启动了
2.如果提示ssh服务不存在需要安装ssh服务端
apt-get install openssh-server;
3.启动sshserver
/etc/init.d/ssh start
4.SSH配置(如果需要)
修改配置文件/etc/ssh/sshd_config,这里可以定义SSH的服务端口,默认端口是22,你可以自己定义成其他端口号如32,然后重启服务
5.重启sshserver
/etc/init.d/ssh restart
开启root远程登陆,修改如下:
vim etc/ssh/sshd_config
#在ssh目录下的ssh_config跟sshd_config,一个是针对客户端的配置文件,后者是针对服务器的配置文件,找到PermitRootLogin without passwd一行将其替换成PermitRootLogin yes,并重启ssh服务即可;
# Authentication:
LoginGraceTime 120
PermitRootLogin without passwd
StrictModes yes
改成
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
重启ssh
/etc/init.d/ssh restart