5

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

ssh [email protected].

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?

3 Answers 3

9

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
4
  • Thanks a lot !!!!!This works but need to password . would you please inform me how can make it password free?
    – skn
    Mar 11, 2012 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, 2012 at 3:10
  • 1
    Why don't you set up public-key authentication? It's easier and more secure.
    – user55325
    Mar 11, 2012 at 4:49
  • 1
    why hasn't this answer been selected yet? Oct 26, 2012 at 20:27
2

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
0

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

alias sshzzz='[email protected].'

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .