I am trying to SSH from one ubuntu18.04 machine to another. For that created a separate user in both machines and added that user in sudo group and edited sshd_config file for PubKeyAuthentication=yes and restarted ssh service.
Then under the createduser in 1st machine, generated ssh-keygen, copied that id_rsa.pub key to 2nd machine under created user, ssh-copy-id -i id_rsa.pub newuser2@[ip-of-2ndmachine]
Now im able to ssh to the 2nd machine without password, but when i execute apt update, its showing permission denied, how to execute the same without password now?
Note: If I give sudo apt update, its asking password, after passing password the cmd is executing.
Can someone help me to execute all cmds in 2nd machine without providing password with newuser(not root).
Executing play: ansible-playbook apachews.yml
PLAY [webservers]
fatal: [172.xx.xx.xx]: FAILED! => {"changed": false, "msg": "Failed to lock apt for exclusive operation"}
PLAY RECAP 172.xx.xx.xx : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
– Dhamodharan Jul 24 '19 at 09:35