Ansible免密登陆权限问题

今天安装了ansible
执行了
sh-keygen
ssh-copy-id -i .ssh/id_rsa.pub username@ip

        管理机执行出现以下情况:
        [weblogic@yhb128 ~]$  ansible 192.168.232.145 -m shell -a  'pwd' -u weblogic

[DEPRECATION WARNING]: ACCELERATE_PORT option, Removing accelerate as a connection method, settings not needed either. . This feature will be removed in version 2.5. Deprecation warnings
can be disabled by setting deprecation_warnings=False in ansible.cfg.
192.168.232.145 | SUCCESS | rc=0 >>
/home/weblogic

[weblogic@yhb128 ~]$ ansible 192.168.232.145 -m shell -a 'pwd' -u web1
[DEPRECATION WARNING]: ACCELERATE_PORT option, Removing accelerate as a connection method, settings not needed either. . This feature will be removed in version 2.5. Deprecation warnings
can be disabled by setting deprecation_warnings=False in ansible.cfg.
192.168.232.145 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"unreachable": true
}

受管理机用户情况:
[web1@yhbnew ~]$ more /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
saslauth:x:499:76:Saslauthd user:/var/empty/saslauth:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
weblogic:x:500:500::/home/weblogic:/bin/bash
web1:x:501:501::/web1:/bin/bash
web2:x:502:502::/home/web2:/bin/bash

用户目录为/home下的可以被ssh免密登陆,而web1用户目录为/web1,却不可以被免密登陆,这是为什么?
经确认weblogic与web用户的用户目录下都有.ssh/authorized_keys

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问