码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS 7安装和配置ssh

时间:2018-05-01 12:26:09      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:cat   otl   客户端   配置文件   serve   ls -l   打开   class   ota   

 

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文件存储的是客户端的公共密钥。

 

CentOS 7安装和配置ssh

标签:cat   otl   客户端   配置文件   serve   ls -l   打开   class   ota   

原文地址:https://www.cnblogs.com/liuhouhou/p/8975812.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!