Google Cloud原本自帶的SSH工具用著也挺不錯,但是由于國內(nèi)的網(wǎng)絡(luò)環(huán)境和統(tǒng)一集中管理等原因,還是用SSH工具管理VPS方便一些。
我只試了一下CentOS,其他的Linux系統(tǒng)沒有試過,不過原理應(yīng)該也是一樣的。
一、修改ssh配置文件并設(shè)置root密碼
1.首先使用Google Cloud SSH登錄VPS
2.切換到root賬戶
sudo-i
3.編輯ssh配置文件
vim/etc/ssh/sshd_config
4.修改以下內(nèi)容即可
按鍵盤【i】進(jìn)入編輯,按【Esc】退出編輯,再輸入:wq保存并退出
5.重啟ssh
service sshd restart
6.為root賬戶設(shè)置密碼
passwd
輸入密碼
輸入密碼的時候不會顯示出來,所以直接輸入密碼,然后回車,再然后重復(fù)輸入密碼回車
確認(rèn)密碼再輸入一次
設(shè)置成功
二、用shell工具登錄谷歌云實例
1.安裝Finalshell連接工具
點擊下載Finalshell下載完成后直接安裝就好
2.打開Finalshell軟件連接服務(wù)器
點擊【SSH連接Linux】
輸入賬戶和密碼
雙擊登錄
點擊【接受并保存】
連接成功
拓展
可以用下面的命令改配置文件,然后改下密碼,重啟一下系統(tǒng)。
CentOS和Debian通用
sed-i's/PermitRootLogin no/PermitRootLogin yes/g'/etc/ssh/sshd_config
sed-i's/PasswordAuthentication no/PasswordAuthentication yes/g'/etc/ssh/sshd_config
Ubuntu系統(tǒng)
sed-i's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g'/etc/ssh/sshd_config
sed-i's/PasswordAuthentication no/PasswordAuthentication yes/g'/etc/ssh/sshd_config
重啟服務(wù)器
reboot