1.ubuntu安装ssh
用xshell远程Ubuntu操作系统时,显示连接失败,原因是系统未安装openssh-server服务
安装ssh服务器
sudo apt install openssh-server
ssh默认端口为22,为了安全,一般自定义为其他端口,然后重启
sudo vim /etc/ssh/sshd_config
打开配置文件,找到如下信息,将Port注释去掉,并将22设置为要设置的端口,保存并重启sshd
sudo systemctl restart sshd
2.允许root用户远程登录
打开ssh服务配置文件,找到如下配置信息,修改为PermitRootLogin yes
sudo vim /etc/ssh/sshd_config
重启服务
sudo systemctl restart sshd
或者
sudo /etc/init.d/ssh restart