Using SSH to Log in to a Remote Server as the Current Userid

[email protected]:~> ssh bible

The authenticity of host 'bible (192.168.0.1)' can't be established. RSA key fingerprint is e3:0a:4b:1e:d5:55:80:24:e4:7d:5f:86:23:f2:1d:8a. Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'bible,192.168.0.1' (RSA) to the list of known hosts. Password:

Last login: Wed May 12 13:30:36 2005 from console

[email protected]:~>

If you look at the output in the preceding listing, you notice quite an important thing happening when we attempted to log in to the machine bible. We were told that the machine has not been recognized and thus is not trusted. This is part of the security of the SSH protocol. You will see this warning for every machine you log in to for the first time. If you want to proceed and log in to the server, your client will make a note of the fingerprint of the remote server.

If you try to log in to the server again, but someone has maliciously tricked you into thinking you were connecting to your original server (when, in fact, it was a bogus server with the same name), SSH knows that the fingerprint of the machine is bogus and warns you of this when you log in.

As you can see, we were not asked for a username because the SSH client already knew we wanted to connect as the user justin.

If you want to connect to the SSH server as another user, you have two options: use the -l switch to specify either the user or the more compact [email protected] notation. For example:

[email protected]:~> ssh [email protected] Password:

Last login: Tue Jul 6 04:23:05 2005 Have a lot of fun... bible:~ #

Because we specified the username on the command line, we were asked for that user's password and not ours. In this case, we logged in as the user root.

Was this article helpful?

0 0

Post a comment