How To SSH without a password

On your Mac laptop:
# move into the .ssh directory, which is where ssh keys are stored.
cd ~/.ssh

# generate a new key pair
ssh-keygen

# (give a name like "itp_rsa" or whatever you want.  Just hit enter through all other questions)
# for this example, let's pretend we called it itp_rsa.  This will generate two files:
# itp_rsa and itp_rsa.pub
#change permissions on the private key so no one else can see it.
chmod 600 ~/.ssh/itp_rsa

#use the command line sftp to put the keys in your itp account's .ssh directory
sftp [NETID]@asterisk.itp-redial.com

# put in your net-id password. Issue the following commands at the > prompt, replacing # [MAC-USER-NAME] with your mac's current user account name:
put /Users/[MAC-USER-NAME]/.ssh/itp_rsa.pub .ssh/itp_rsa.pub
quit

#That's it! The public rsa key file is now on your ITP server.

In your account on the ITP server:

## ssh into your account
cd ~/.ssh

# "cat" will print out the contents of a text file.
# The ">>" will append that text into another file.  In this case, "authorized_keys"
#If the file doesn't exist, then the file will get created.
cat itp_rsa.pub >> authorized_keys

# that's it!

Now, you can ssh on to the ITP server from your laptop without a pasword!

ssh -i ~/.ssh/itp_rsa [NETID]@asterisk.itp-redial.com

So why is this potentially more convenient? Because we can now automate the ssh process. For example, you could add an alias to your .bash_profile or .bashrc file:

alias redial='ssh -i ~/.ssh/itp_rsa [NETID]@asterisk.itp-redial.com'

Now you just have to type “redial” to gain access to your remote directory at asterisk.itp-redial.com.