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 16drwx------. 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文件存儲的是客戶端的公共密鑰。
發佈了9 篇原創文章 · 獲贊 2 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章