使用者工具

網站工具


linux:ssh

5 安裝並啟動ssh遠端連線伺服器


ssh遠端連線可以說是網管人員最重要的工具,遠端連線的意思就是不用特地跑到機房的電腦前操作,只要網路與硬體正常,ssh server有在運作,幾乎都可以在遠端上排除系統上的問題。現在我們可以透過上一章節教的Yum工具來安裝ssh server。

5.1 安裝ssh server

ssh server在Yum軟體倉庫中的名稱是openssh-server

[cbb104026@localhost ~]# yum install openssh openssh-server
[cbb104026@localhost ~]# service sshd start  #啟動ssh server
[cbb104026@localhost ~]# chkconfig sshd on   #設定開機自動啟動

5.2 設定ssh

ssh的設定檔在/etc/ssh/sshd_config

[cbb104026@localhost ~]# vi /etc/ssh/sshd_config
[cbb104026@localhost ~]# service sshd restart  #重新啟動ssh server,以套用設定

5.3 首次遠端連線

目前我們還沒有教到防火牆的相關設定,測試時可以先暫時關閉防火牆。如果是在虛擬機器內,記得要先設定網路卡介面或端口轉發,才可以在電腦內透過終端機或是ssh連線工具遠端登入到虛擬機器。

[cbb104026@localhost ~]# service firewalld stop
[cbb104026@localhost ~]# chkconfig firewalld off
[cbb104026@localhost ~]# yum install net-tools
[cbb104026@localhost ~]# ifconfig
ssh username@ip_or_domain -p port

linux/ssh.txt · 上一次變更: 2019/07/02 15:01 由 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki