Ssh no password question

Not sure I can articulate this well, but I’ll try. I have set up ssh with the keys to log in with no password prompt. Local network, play area, don’t care about security. Everything works as expected.

I have a user with user ID abc on server_a and the same user with user ID def on server_b.

User abc needs to copy his files nightly via cron (rsync) to his def account on server_b.

Trying to figure out if user abc can ssh into server_b as user def without having to type in a password. I realize security heads are exploding, but again, this is play time.

Is this possible?

It is possible using keys rather than passwords. I don’t have a dedicated description handy, but you may check https://backuppc.sourceforge.net/faq/ssh.html as backuppc is using this mechanism to connect automatically to a remote machine without password.

Hope this helps,

Michael

That is what we all do, always. When we ssh to remote machine, we must state the account that we want to use in the remote machine. If we do not state it in the ssh config or the command line, then the ssh client uses our local username.

That is, the following two are practically identical commands:

[abc@server_a ~]$ ssh server_b
[abc@server_a ~]$ ssh abc@server_b

You, however, want to be “def” in server_b and therefore have to use:

[abc@server_a ~]$ ssh def@server_b

I did write “ssh config” above. It is possible to store usual options for particular connections to a file:

[abc@server_a ~]$ cat ~/.ssh/config
Host s_b
  HostName server_b
  User def

With that config we can write

[abc@server_a ~]$ ssh s_b

and ssh client expands that to the ssh def@server_b

This make use of , say rsync, easier as you can:

rsync -av myfile.txt s_b:myfile.txt

(The rsync will use ssh for transport, including the config.)


The above had nothing to do with authentication.
Whether you use password, keypair, or whatnot to authenticate as def@server_b is separate.

Thanks for the insight. Think I figured it out: It was an antiquated ACL permissions problem on the remote host that prevented ssh from getting through the home directory to be able to see the key files

1 Like