SSH+better

In this course we use SSH a lot, both directly (get onto login.cs.nmt.edu) and indirectly (every time you do a git pull). If you don't adopt some shortcuts, you will probably hate typing in your passwords in no time.

SSH aliases:
Instead of having to type "ssh username@login.cs.nmt.edu" everytime you log on to login, you can instead use a command like "ssh login". Assuming you're on a *nix system, just edit your ssh config file, found in ~/.ssh/config. If it doesn't exist, create it, and add the following text:

code Host login User username HostName login.cs.nmt.edu code

The two lower lines should be indented two spaces each. Now you can use "ssh login" instead of the much longer form.
 * login (after "Host") is just an alias, and can be whatever you want.
 * username should be your own, obviously.
 * login.cs.nmt.edu is the address of the server.
 * if the server is not on port 22 (the default), add " Port portnumber" as a third line.

Passwordless login:
This is an area where not using passwords is actually more secure, not less. It's also much easier. Now you should be able to login without entering your password. Try "ssh login" to make sure this works.
 * 1) Check to see if you have a public key: "ls ~/.ssh", see if you have id_rsa.pub listed.
 * 2) If you don't, create one: "ssh-keygen". It will prompt for a password. You can either leave it blank, or if you're paranoid you can enter one. If you do, your operating system might still add it to your keychain the next time you use it, and you can still get passwordless logins.
 * 3) Tell login to accept your public key: "ssh-copy-id -i ~/.ssh/id_rsa.pub login". Note that using "login" only works if you set up the alias as above; otherwise use username@login.cs.nmt.edu instead. Enter your password to authenticate your public key.

With git:
To make sure that using git works with this and doesn't require passwords, using your alias when you clone a repository: ``"git clone ssh://login/~cse221/docs.git cse221"``. Note that the alias "login" replaces "username@login.cs.nmt.edu". If you don't want to create a new tree, you can change the origin of your current tree; in your project root (cse221, for example), edit the file .git/config. There should be a few lines like:

code [remote "origin"] url = ssh://username@login.cs.nmt.edu/~cse221/docs.git code

Just change the "username@login..." portion to your alias.