Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to shorten my SSH login from my Mac computer to remote computer. Currently, I log in with

ssh username@remote.anu.edu.au.

I tried to replace the command using a short name in the cshrc file, but it did not work. How can I log in to the remote computer without having to type the full command above?

share|improve this question
add comment

3 Answers

You can add a config file (no file extension) to your .ssh folder with the following entry:

Host x
HostName example.com
User me
IdentityFile ~/.ssh/key

Now, you can log in to example.com with the username me and private key key with the following command:

ssh x
share|improve this answer
    
Thanks a lot !!!!!This works but need to password . would you please inform me how can make it password free? –  skn Mar 11 '12 at 3:01
2  
Oh. You did not mention using a password, so I assumed you used a key. It's a bit more difficult to pass a plain-text password with SSH. This question on AskUbuntu has a couple of solutions: askubuntu.com/questions/87956/… –  iglvzx Mar 11 '12 at 3:10
1  
Why don't you set up public-key authentication? It's easier and more secure. –  user55325 Mar 11 '12 at 4:49
1  
why hasn't this answer been selected yet? –  spyroboy Oct 26 '12 at 20:27
add comment

If you want to have it "password free", you can use PublicKey authentification. It is one of the few concepts that is more secure and also easier.

All you need to do is create a keypair on the client and send the publickey to the server.

Create the keypair: (you should use a strong passphrase)

ssh-keygen -t rsa

Send your new created publickey to the server:

ssh-copy-id -i ~/.ssh/id_rsa.pub user@server

Now you should be able to login without a password. If not, make shure to configure your ssh server like this:

PasswordAuthentication no
UsePAM no
share|improve this answer
add comment

How about setting an alias in your shell's profile?

alias sshzzz='username@remote.anu.edu.au.'

Then you can just type sshzzz and then put your password in.

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.