CentOS 7安裝和配置ssh


 

1. 安裝openssh-server

yum install -y openssl openssh-server

2. 修改配置文件

用vim打開配置文件/etc/ssh/sshd_config

將上圖的PermitRootLogin,RSAAuthentication,PubkeyAuthentication的設置打開。

啟動ssh的服務:

systemctl start sshd.service

設置開機自動啟動ssh服務

systemctl enable sshd.service

設置文件夾~/.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文件存儲的是客戶端的公共密鑰。

 


免責聲明!

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



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