Friday, April 18, 2008

Tips on ssh

1. Use ssh-keygen to generate key pairs
# ssh-keygen -t rsa -b 2048
ssh-keygen can generate both RSA and DSA keys. While you can specify any key length for RSA keys (in the example it is set to 2048 bits), the key length for DSA is always 1024 bits as required by the government. RSA is also faster when it comes to verify the key.

After ssh-keygen generates the key pair, put id_rsa.pub to ~/.ssh/ on the remote machine and rename it to authorized_keys.

Now enjoy remote login without having to input your password. (Of course you have to make sure the physical access to your machine is secured.)

2. Use ssh_config to specify ssh setting

You can put the configuration into the file ~/.ssh/config. Below is an example
Host short
HostName long.server.name
User name
Then you only need input
# ssh short
instead of
# ssh name@long.server.name
For more options, man ssh_config.

No comments: