How to connect to a Unix server

1. From a Windows client

You need to download 2 free programs to connect to a Unix server securely and run GUI programs remotely: Putty and Xming. You can run former directly, but need to install the latter first.

After you double click putty.exe to run, you are going to see the dialog like below:

Screenshot

Create a profile for each Unix server you want to connect to. For example, to connect to CS server at SRU, type the URL of cs.sru.edu in "Host Name" field, and name the profile as "SRU" in "Saved Session" field, just like the screenshot below.

Screenshot

Click "Save" button to save the profile so that later you can just double click the profile name to initiate the connection to the same server.

For the first time, you are going to be greeted with the dialog as shown below that prompts you to accept the public key from the server. Click "Yes" button to accept the public key for subsequent encryption.

Screenshot

Then you are going to see the terminal window like below.

Screenshot

After you type your username and password, you are logged into the Unix server.

Screenshot

If you need to run GUI programs remotely, firstly you need to start Xming X server, which shows an icon in the notification area in the taskbar.

Screenshot

Then you need to enable X11 forwarding in the profile in Putty. Firstly you need to load SRU profile, then go to "Connection" -> "SSH" -> "X11", check "Enable X11 forwarding" checkbox, just like the screenshot below (Don't forget to go back to "Session" page to save the changes to the profile).

Screenshot

After you log into the Unix server, you can run GUI programs. The screenshot below is gedit:

Screenshot

2. From a Unix client

On command line, issue the command:

ssh cpsc207@cs.sru.edu

If you have the same user name at both the local Linux box and remote Unix server, you can just give the URL of the server:

ssh cs.sru.edu

For the first time, you are prompted to accept the public key from the Unix server:

The authenticity of host 'cs.sru.edu (10.1.40.69)' can't be established.

RSA key fingerprint is 7c:4e:8e:ed:27:17:7f:ec:2e:ef:85:f0:84:77:b3:0a.

Are you sure you want to continue connecting (yes/no)?

Type "yes" to accept the public key. Then type your password to log into the Unix server.

If you need to run GUI programs remotely, issue the command:

ssh -X cpsc207@cs.sru.edu

3. Other features in SSH (Linux)

You can append a Linux command after ssh command line to log into the Linux server, run the command, and then close the connection. For example:

$ ssh zhou@cs.sru.edu "date"

Wed Apr 16 14:52:27 EDT 2008

Usually SSH will foward any keystrokes to the Linux server. For example, when you press Ctrl-Z, it is sent to the server to pause the foreground job in the SSH session. How can we pause SSH session itself?

SSH supports some special escape sequences that target itself, which are listed below:

SequenceMeaning
~?Print a help message
~Ctrl-ZSuspend the SSH connection
~.Terminate the SSH connection
~#Show all the forwarded connections