SecureCRT通過SSH2協議遠端登入Ubuntu 18.04的過程總結
reference: https://blog.csdn.net/ghostar03/article/details/47441715
https://blog.csdn.net/u011186256/article/details/79963544
要用SecureCRT連線Ubuntu,在linux中ssh程式分為 :openssh-client和 openssh-server。如果需要ssh登陸到別的電腦,需要安裝openssh-client,該程式ubuntu是預設安裝的。而如果需要從遠端連線到本機,則需要安裝openssh-server,該程式需要自己安裝。
環境:windows10、虛擬機器Ubuntu 18.04
協議:SSH2
windows端軟體:SecureCRT
Ubuntu端軟體:openssh-server
Windows端使用:
建立連結
新建連結:
選擇通訊協議:
然後根據IP設定
Ubuntu端安裝:
1、首先要安裝ssh功能:
sudo apt-get install openssh-server
此時出現錯誤--Could not get lock /var/lib/dpkg/lock
接著在終端輸入:
sudo rm /var/lib/dpkg/lock
然後再執行安裝程式碼
sudo apt-get install openssh-server
sudo apt-get install openssh-client
檢視openssh-server是否啟動
$ ps-e | grep sshd 或ssh
啟動ssh服務
2、修改配置檔案
sudo pico /etc/ssh/ssh_config
去掉PasswordAuthenitcation, Port 22,Protocol2,1這三行前的註釋#
執行發現
祕鑰互動失敗,需要修改相關配置檔案:
將ssh_config檔案中的
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
複製到sshd_config檔案中,然後重啟服sshd伺服器
/etc/init.d/ssh restart
連線成功:
現在我們已經可以正常連線使用我們虛擬的Linux,但是現在還有一個問題,我們怎麼在他們直接傳輸檔案呢,有人說可以設立共享資料夾,可是如果是VPS主機的話怎麼辦呢?
下面介紹一個經典的檔案傳輸的工具rz(上傳)和sz(下載)
有的ubuntu源裡面可能沒有了,如果有的話可以方便的直接安裝
sudo apt-get install lrzsz
可是如果源裡面沒有怎麼辦呢,沒關係,下面說怎麼安裝
1、下載原始碼
wgethttp://down1.chinaunix.net/distfiles/lrzsz-0.12.20.tar.gz
2、tar zxvf lrzsz-1.12.20.tar.gz
3、cd lrzsz-1.12.20
4、./configure–prefix=/usr/local/lrzsz
5、make
6、make install
7、建立符號連線
#cd /usr/bin
#ln -s /usr/local/lrzsz /bin/lrz rz
#ln -s /usr/local/lrzsz /bin/lsz sz
8、試試
當在SecureCRT裡面執行rz 的時候就會彈出SecureCRT上傳視窗,檔案會傳到當前的目錄了。
Ps:可以管理多個linux主機哦,那你就擁有一個Linux主機叢集啦。