信息发布→ 登录 注册 退出

centos如何安装ssh?

发布时间:2020-07-28

点击量:
centos安装ssh的方法:首先安装【openssh-server】;然后修改配置文件,并启动ssh的服务;接着设置开机自动启动;最后设置文件夹【~/.ssh】的访问权限即可。

centos安装ssh的方法:

1. 安装openssh-server

yum install -y openssl openssh-server

2. 修改配置文件

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

将上图的PermitRootLoginRSAAuthenticationPubkeyAuthentication的设置打开。

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  # 配置文件  # 的是  # 自动启动  # 访问权限  # 上图  # 客户端  # PermitRootLogin  # RSAAuthentication  # sshd_config  # code  
在线客服
服务热线

服务热线

4008888355

微信咨询
二维码
返回顶部
×二维码

截屏,微信识别二维码

打开微信

微信号已复制,请打开微信添加咨询详情!