Is there a way for a user to ssh as a different user using ssh_keys? For example, i have host A B and C.
User X SSHes from A to B as himself ( A -- as X --> B ) Now the user wants to SSH to C from B but as a diff account ( Y ) B --- as Y ---> C
I have the keys stored in /home/Y/.ssh/ [id_rsa | id_rsa.pub]
Now When X is on B and runs
ssh Y@C will this pick the SSH key from Y ? or should the key be specified in the command with -i flag, like
ssh Y@C -i /home/Y/.ssh/id_rsa
The first didnt work for me it asked for password, when i copied the keys to my home dir path, i.e into
/home/X/.ssh/ and gave permission it worked.
Ideally i would like to allow anyone SSH ing to B to SSH to C as Y. And i dont want to copy the key to each persons home dir. How would i go about with this? Thanks.