Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I use ssh command to log in to a remote shell, my local user name is used and only password (or a certificate passphrase) is requested. How do I login as a different remote user without adding this user on my local PC?

share|improve this question
add comment

3 Answers

up vote 10 down vote accepted

Use

ssh username@hostname

or

ssh -l username hostname

Either one works.

share|improve this answer
add comment

I normally use slogin instead of ssh - the difference is minimal (both are parts of OpenSSH). With slogin you use this form:

slogin user@host

slogin was designed to replace rlogin (thus the name). This should work almost anywhere that OpenSSH is installed (technically, you don't need to install the r* replacements, but they usually are...)

One more thing: you can configure OpenSSH to use a particular user name when you log into a remote host - like so (in ~/.ssh/config):

Host fred
  User moxie

Host gabbie
  User mpotts

Host serial
  Hostname vx-port-lx08486-px-l1
  User fred

Then use ssh like so:

ssh gabbie

(will log in as mpotts). The example for serial will also allow the shorthand name "serial" instead of the long and hard to remember hostname - with username.

share|improve this answer
2  
+1 for the ~/.ssh/config - this makes life so much easier. –  Hamish Downer Jul 12 '10 at 9:42
    
On OS X at least, slogin is a symlink to ssh, so the differences are minimal indeed. –  rvalue Oct 13 '13 at 12:12
add comment

ssh <user>@<host> or ssh -l <user> <host> are two ways to specify the user you want to connect as.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.