I have an Ansible server with 3 ubuntu servers (hosts). So i want to be able to logon to those servers by typing in the SSH key password once. I have edited my .bashrc with an alias.
alias ssha='eval $(ssh-agent) && ssh-add'
Whenever i login to the Ansible server and do:
foulan@ansible-server:~$ ssha
Agent pid 1396
Enter passphrase for /home/foulan/.ssh/id_ed25519:
If i typ in the password for the ssh-key, i'm able to login every server without prompting the password. But if i go after that in root mode by typing sudo su
.
And again try to ssh in to one of my servers it asks me for me for the password.
But if i run
ps aux | grep ssh
it still shows me that the ssh-agent in the back is running ??
I basically want to be able to ssh to any server in root mode without typing the pass everytime
Any help would be appreciated,
su
switch user. As soon as you run that you are a different user without your previous environment.. Note to mention the REALLY bad security practise. If you MUST log in as root ask for key based login to the root user.