LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-04-2007, 01:17 PM   #1
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
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
 
Old 02-04-2007, 01:41 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,697

Rep: Reputation: 61
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
 
Old 02-04-2007, 01:53 PM   #3
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Original Poster
Rep: Reputation: 45
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

Last edited by Micro420; 02-04-2007 at 02:02 PM.
 
Old 02-04-2007, 02:10 PM   #4
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 48
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
 
Old 02-04-2007, 02:13 PM   #5
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Original Poster
Rep: Reputation: 45
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????

Last edited by Micro420; 02-04-2007 at 02:28 PM.
 
Old 02-04-2007, 02:34 PM   #6
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,697

Rep: Reputation: 61
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't login with ssh pub keys fisayo Mandriva 2 11-17-2005 07:12 PM
SSH Login - Forcing keys! jackster Linux - Security 5 01-25-2005 08:09 AM
SSH keys alon005 Linux - Security 5 10-14-2004 03:39 AM
Can't login using ssh keys linuxboy69 Linux - Software 2 03-19-2004 02:47 PM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 03:31 AM


All times are GMT -5. The time now is 02:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration