Operating System - HP-UX
1848422 Members
3514 Online
104027 Solutions
New Discussion

Re: ssh without passwords between two id's on two diff. servers

 
Hanry Zhou
Super Advisor

ssh without passwords between two id's on two diff. servers

I know I can ssh to another server without using passwords, but what if as user-a ssh to user-b on another server without using passwords? I know it is doable, but don't know how?
Thanks,
none
3 REPLIES 3
Steven Schweda
Honored Contributor

Re: ssh without passwords between two id's on two diff. servers

td176> ssh -h
Usage: ssh [options] host [command]
Options:
-l user Log in using this user name.
[...]

td176> man ssh
[...]
-l login_name
Specifies the user to log in as on the remote machine. This also
may be specified on a per-host basis in the configuration file.


Depending on how you arrange the key files,
"-i" might also be useful.
Ivan Ferreira
Honored Contributor

Re: ssh without passwords between two id's on two diff. servers

You use the same procedure, but instead of uploading the public key to the same home directory, upload to the home directory of the target system, then connect using

ssh targetuser@targethost

Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Inter_1
Frequent Advisor

Re: ssh without passwords between two id's on two diff. servers

1. generate on your LOCAL machine a keypair with: ssh-keygen -t rsa (dont type in any password, just keep hitting enter)
2. make sure your private key resides under ~/.ssh (under windows this can be under
3. file transfer the PUBLIC key to the machine you which to automatically logon to. Under the directory ~/.ssh (create it if necessary) concatenate your public key with the file authorized_keys (create file if needed)
4. make sure the authorized_keys not read or modifiable by group or others my doing chmod 700 ~/.ssh/authorized_keys
5. make sure the ~/.ssh directory on the REMOTE machine is not read or modifiable by group or others my doing chmod 700 ~/.ssh
6. You may need to enable empty password authentication (need root access) on the REMOTE machine in the config file sshd_config. Make "permitemptypasswords yes". Restart SSH Daemon on REMOTE.
7. On some machines, you may also need to make sure your HOME directory is not writable by group or world. Type chmod 700 ~
I like to fix things.