更新资源
sudo apt-get update
对软件进行升级
sudo apt-get upgrade
升级系统版本
sudo apt-get dist-upgrade
安装openssh-server
sudo apt-get install openssh-server
查看ssh服务是否开启
ps -e |grep ssh
启动服务
sudo /etc/init.d/ssh restart
报错处理
root@DESKTOP-R5E7NDM:~# sudo /etc/init.d/ssh restart
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
* Restarting OpenBSD Secure Shell server sshd Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
cd /etc/ssh/
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_keyssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_keyssh-keygen -t rsa -f /etc/ssh/ssh_host_ecdsa_keyssh-keygen -t rsa -f /etc/ssh/ssh_host_ed25519_key
修改配置
vim /etc/ssh/sshd_config
进入/etc/ssh/sshd_config查找PermitRootLogin选项(可以利用:/PermitRootLogin的方法进行查找)
将这个选项后面的值(一般为prohibit-password)修改为yes
其他
apt install openssh-server #安装openssh-server
service ssh start #启动openssh-server
ps -e |grep sshd #查看ssh服务是否启动 -e查看全部进程
service ssh status #查看ssh运行状态
service ssh restart #重启
声明:本站部分内容及图片来自互联网,转载是出于传递更多信息之目的,内容观点仅代表作者本人,如有任何标注错误或版权侵犯请与我们联系(Email:2595517585@qq.com),我们将及时更正、删除,谢谢。