更新資源
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 #重啟