Ubuntu安裝openssh-server並通過xshell連接


#安裝ssh
sudo apt-get install openssh-server openssh-client
sudo apt-get update
sudo apt-get upgrade

查看ssh是否啟動

ps -ef|grep ssh

如果沒啟動,執行啟動命令

/etc/init.d/ssh stop
/etc/init.d/ssh start
/etc/init.d/ssh restart

修改ssh配置文件

vim /etc/ssh/sshd_config

找到PermitRootLogin prohibit-password 

改為PermitRootLogin yes

#測試ssh
ssh localhost
#22端口設為防火牆例外
sudo ufw allow 22/tcp
#或者直接關閉防火牆
sudo ufw diable

如果重啟后沒有自動啟動,需要配置openssh-server開機自動啟動 :打開/etc/rc.local文件,在exit 0語句前加入  /etc/init.d/ssh start

下載安裝xshell,新建會話,主機中輸入ubuntu系統的ip地址,用戶名root及密碼,點擊連接,可以看到連接成功的提示:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM