目录shell
一 环境centos
系统环境ssh
软件环境ui
二 免密配置spa
1.操做步骤code
2. 配置失败caseorm
一 环境ip
系统环境: CENTOS 6.6 内核 2.6.32ci
[xxx@scripts-1 ~]$ lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.6 (Final) Release: 6.6 Codename: Final
[xxx@scripts-1 ~]$ cat /proc/version Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Oct 15 04:27:16 UTC 2014
2. 软件版本string
[xxx@scripts-1 ~]$ strings /usr/sbin/sshd |grep OpenSSH OpenSSH_5.3p1-FC-0.9.3-104.el6 OpenSSH_5.3p1 OpenSSH_5.3 OpenSSH_2.3.0* OpenSSH_2.3.* OpenSSH_2.5.3* OpenSSH_3.* OpenSSH_4* OpenSSH* OpenSSH-2.0*,OpenSSH-2.1*,OpenSSH_2.1*,OpenSSH_2.2* OpenSSH_2.5.0p1*,OpenSSH_2.5.1p1* OpenSSH_2.5.0*,OpenSSH_2.5.1*,OpenSSH_2.5.2* OpenSSH_2.*,OpenSSH_3.0*,OpenSSH_3.1*
二 免密配置
1:目前有主机A 和主机B,但愿从从主机A 能免密登陆到主机B
1主机A 上生成 密钥
[xxx@scripts-1 ~]$ ssh-keygen -t rsa
查看主机A 当前用户家目录下 .ssh 目录
公钥 在次文件里 id_rsa.pub
1.2 将A 主机公钥 放到 B 主机家目录 ./ssh 目录下authorized_keys 文件里
1.3 密钥的配置完成
2 失败case
此次作了不少主机的免密登陆,绝大多数 均可以避免密登陆,只有少数台不能登陆。
比对SSH 的配置文件作了比对,也是彻底同样。
以后分析到缘由 : 是被登陆的主机 用户目录权限的问题:
1. 假设是B 主机,且免密登陆用户名 为test
2. test 家目录权限需为 700 即 chmod 700 /home/test
3. .ssh 目录权限需为700 chmod /home/test/.ssh
4 authorized_keys 文件权限 需为 600 chmod 600 /home/test/.ssh/authorized_keys