首頁  >  文章  >  運維  >  centos如何安裝ssh?

centos如何安裝ssh?

coldplay.xixi
coldplay.xixi原創
2020-07-28 11:45:1519738瀏覽

centos安裝ssh的方法:先安裝【openssh-server】;然後修改設定文件,並啟動ssh的服務;接著設定開機自動啟動;最後設定資料夾【~/.ssh】的存取權限即可。

centos如何安裝ssh?

centos安裝ssh的方法:

1. 安裝openssh-server

yum install -y openssl openssh-server

2 .修改設定檔

用vim開啟設定檔/etc/ssh/sshd_config

centos如何安裝ssh?

將上圖的PermitRootLogin RSAAuthenticationPubkeyAuthentication的設定開啟。

3、啟動ssh的服務:

systemctl start sshd.service

4、設定開機自動啟動ssh服務

systemctl enable sshd.service

5、設定資料夾~/.ssh的存取權限:

$ cd ~
$ chmod 700 .ssh                                                                                                
$ chmod 600 .ssh/*                                                                                              
$ ls -la .ssh                                                                                                   
total 16
drwx------. 2 root root   58 May 15 00:23 .
dr-xr-x---. 8 root root 4096 May 15 00:26 ..
-rw-------. 1 root root  403 May 15 00:22 authorized_keys
-rw-------. 1 root root 1766 May 15 00:21 id_rsa
-rw-------. 1 root root  403 May 15 00:21 id_rsa.pub

authorized_keys檔案儲存的是客戶端的公共金鑰。

相關教學推薦:centos教學

以上是centos如何安裝ssh?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn