CS536 - Spring 2022, University of Wisconsin Using SSH and SCP CS536 Intro to Programming Languages and Compilers Secure Shell (SSH) is a way of communicating between computers through an encrypted channel. When you SSH to another computer, you can execute commands on the remote computer from your own computer. Typically, you might use SSH to connect your personal computer with a lab computer to work or to transfer files. Connecting using SSH You can use any terminal program (Terminal on Macs, Cygwin or others on Windows) to establish an SSH connection. To connect via SSH: Open your terminal program and enter: ssh
@best-linux.cs.wisc.edu where is your CS login. If this doesn't work, try connecting to best-rockhopper.cs.wisc.edu or best-royal.cs.wisc.edu or best-snares.cs.wisc.edu, or royal-NN.cs.wisc.edu where NN is a two digit number between 01 and 30. Type yes to any prompts Enter your password when asked for it. You may now execute commands on the remote computer as if you were physically logged in on it. For example, you use SCP to transfer your programs (see below) and then issue compilation and run commands from an SSH session: To compile HW1.java, issue the command: javac HW1.java To run HW1, issue the command: java HW1 (where are the command-line arguments your program takes, if any) To log out from your SSH session, type logout in the SSH terminal. See the Remote Access page for more information about remote access. File transfer using SCP Secure Copy (SCP) is method of transferring files between computers over a secure channel. It uses the SSH protocol to do so. SCP works just like the Linux cp command except one of the operands refers to a remote location. Note that you do not have to establish your own SSH connection first. scp The remote location must be specified using a special format: @: The @ part may be omitted if the username on the remote computer is the same as your current username on your computer. For example, to copy over a file from your homework folder to your home directory on the CS machines, you might issue an SCP command as follows: scp homework/* best-linux@cs.wisc.edu:private/homework/ This command will move all files from your local homework directory to ~/private/homework on the CS file system. It is safest for the destination folder to exist before the command is issued.