安装openssh和启动
由于openssh依赖于openssl库,所以在安装openssh前要先安装openssl库
Ubuntu默认安装了ssh client端但没有安装Server端,所以首先安装ssh-server服务。命令如下:
sudo apt-get install openssh-server
server启动后出现 root连接时显示ssh服务器拒绝了密码,sshd的设置不允许root用户用密码远程登录;
//异常信息
Permission denied, please try again.
通过打开sshd_config
vim /etc/ssh/sshd_config
找到PermitRootLogin制成yes;
# Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes
12345
更改
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
12345
//然后输入命令重新启动server
/etc/init.d/ssh restart
//启动service ok
[ ok ] Restarting ssh (via systemctl): ssh.service.