Introduction to SSH
SSH (Secure SHell) is a tool that lets you connect to another computer over the Internet to run commands on it.
You run the ssh
command in your terminal to use it.
The Cornell CS department has several machines available to you, if you want to use them to do your work. SSH is the (only) way to connect to these machines.
Accessing Cornell Resources from Off Campus
Cornell’s network requires you to be on campus to connect to Cornell machines. (This is a security measure: it is meant to prevents attacks from off campus.)
To access Cornell machines when you’re elsewhere, Cornell provides a mechanism called a Virtual Private Network (VPN) that lets you pretend to be on campus. Read more about Cornell’s VPN if you need it.
Log On
Make sure you are connected to the VPN or Cornell’s WiFi. Open a terminal window and type:
ssh <netid>@ugclinux.cs.cornell.edu
but replace <>
).
Type yes
and hit enter to accept the new SSH host key.
Now type your NetID password.
You’re in! You should see a shell prompt; you can follow the Unix shell tutorial to learn how to use it.
Here, ugclinux.cs.cornell.edu
is the name of a collection of servers that Cornell runs for this purpose.
That’s what you’d replace with a different domain name to connect to a different machine.
scp
Suppose you have a file on the ugclinux machines and you want to get a copy locally onto your machine.
The scp
command can do this.
It works like a super-powered version of the cp
command that can copy between machines.
Say your file game.c
is located at /home/yourNetID/mygame/game.c
on ugclinux.
On your local machine (i.e., when not connected over SSH already), type:
$ scp yourNetID@ugclinux.cs.cornell.edu:mygame/game.c .
Here are the parts of that command:
$ scp <user>@<host>:<source> <dest>
<user>
and <host>
are the same information you use to connect to the remote machine with the ssh
command.
<source>
is the file on that remote machine that you want to obtain,
and <dest>
is the place where you want to copy that file to.