linux上创建一个用户app,切换到app用户,生成rsa密钥串,实现app用户的免密码登陆:
#生成密钥
ssh-keygen -t rsa
#将自己的~/.ssh/id_rsa.pub内容均加到自己的~/.ssh/authorized_keys文件里
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
#权限
chmod 600 ~/.ssh/authorized_keys
然后进行免密登陆:
ssh app@10.134.32.1
password:
发现仍然需要输入密码。排查过程如下:
1、SELINUX:
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX=disabled
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
确保SELINUX=disabled
2、查看/var/log/secure日志