Ansible .ssh/authorized.key

Hy all,

when i use become_user: wildfly

i have have this message error :

path /home/wildfly/.ssh/authorized_keys does not exist

But this path exist in destination host…

Someone have idea please ??!

Thanks community ansible for your help !! :wink:

ansible version : 2.8

Regards,

May check permissions of authorized_keys

Hy,

Thanks for your answer,
I look permission of authorized_keys but i use user wildfly of /home/wildfly/.ssh/authorized_keys
So the problem is not if there is permission or not ??

I use :

become_user: wildfly

Thanks for your help !!

Regards,

Hy,

For answer, i have this permissions for authorized_keys with user wildfly :

-rw------- 1 wildfly wildfly 7445 Jun 27 12:05 authorized_keys

Thanks,

Regards,

Have you checked permissions on /home/wildfly/.ssh/ too? That needs to be 700 (rwx) – see eg below:

[root@]# ls -ld /home/wildfly/.ssh

drwx------. 2 wildfly wildfly 4096 Jun 7 14:26 /home/ wildfly /.ssh

[root@]#

Regards

Phil

Hy,

I check it and all is ok but not works… When i changed permission 777 it’s works.

I thinks that it’s problem of user use ? but i have the well user … with this command:

become_user: wildfly

Thinks,

Regards,

What task are you trying to perform eventually? If it’s something like adding a new package, you may need to connect with the normal wildfly user first and then become root. If so, something like similar might be more appropriate:

- name: Test

hosts: all

remote_user: wildfly

become: yes

become_method: sudo

Regards

Phil

Hy,

Thank you very much for your help i have solve this problem.

Thanks for your help !! :slight_smile:

Regards,

Did my suggestion work for you or did you resolve it in some other way?

Regards

Phil