LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Using SSH keys with different login name - is it possible? (https://www.linuxquestions.org/questions/linux-networking-3/using-ssh-keys-with-different-login-name-is-it-possible-525529/)

Micro420 02-04-2007 01:17 PM

Using SSH keys with different login name - is it possible?
 
I have COMPUTER A which has a username, let say, John. I have a COMPUTER B which has a username, JohnDoe. I created the public/private keys on COMPUTER A. I send out my public key to COMPUTER B and would like to log in to it with the keys, however, since the login name is different, it does not recognize the keys.

Meanwhile, I have a COMPUTER C with username John that also has the public key of COMPUTER A, and that has no problem since the username is the same.

I have tried using the -i option to specify the location of the profile but it does not work and asks me the passphrase for the key, even though there is no passphrase for it:
Code:

ssh -i ~/.ssh johndoe@ipaddress

Brian1 02-04-2007 01:41 PM

Maybe the permissions on the remote computer B for .ssh and .ssh/authorized_keys

Use the following commands on Computer B home directory of johndoe
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Now try loging as usually.

This info is from here. http://www.suso.org/docs/shell/ssh.sdf
A very good tutorial for ssh.

Brian

Micro420 02-04-2007 01:53 PM

I already had it set with those permissions. Any other ideas?

I guess worse comes to worst, I just useradd a john on COMPUTER B, or useradd a johndoe to COMPUTER A

JimBass 02-04-2007 02:10 PM

Much simpler than that! Man ssh would have told you that -l is the login name. So from computer A,
Code:

John@computerA:~$ssh -l JohnDoe computerB
The key will work fine, as it know knows where to look.

Peace,
JimBass

Micro420 02-04-2007 02:13 PM

DUHHHH! Sorry guys, it turns out it was user error.

I didn't even create the public/private keys! It's a long story, but for security reasons, I am ssh'ing into 2 computers before I reach my destination of the 3rd computer I am trying to hit, which is then trying to connect to the 4th computer. Because of all those 'hops', I got confused as to which computer I was actually working from. :( :( :(

My home <---> Site A <---> Computer A <---> Computer B

I need to learn about SSH tunnels, but I'm always confused about it.

For example, lets say I do
Code:

ssh -L 5900:192.168.1.2:5901 ComputerA
So how I interpret this is connect to computer A via SSH on port 22, then whatever hits port 5900 on ComputerA will forward to port 5901 on computer 192.168.1.2????

Brian1 02-04-2007 02:34 PM

No I don't think that is correct. This always confuses me.
ssh -L <port to forward local machine>:<local machine you are starting the ssh from>:<port on the remote machine will see the port that was forwared> username@remote machine

Brian


All times are GMT -5. The time now is 03:31 PM.