To access and log onto a Unix system, will need:
- A terminal, personal computer, or workstation with SSH version 2 or higher installed. If you wish to run X applications, you must also be running an X server on your workstation (see Using the X Windows System for additional information).
- Access to the Virginia Tech network.
- An account and password on the system where you wish to work.
The name of the login node does vary by system, so please consult the documentation for your system to get the correct name; the login nodes for BlueRidge, for example, are blueridge1.arc.vt.edu andblueridge2.arc.vt.edu.
Secure Shell (SSH) is a protocol for secure communication. An SSH-2 or later client running on your local system is required to logon to the ARC and many other Unix systems.
Mac OS-X, Linux, and most other UNIX systems have a built in ssh client – simply enter the following command to log onto BlueRidge:
where “johndoe” is your Virginia Tech PID. After you have connected to the Unix host, you will be prompted to enter your PID password. Take your time entering the password; with some ssh clients, you will not be able to use the backspace or delete key to correct a typing mistake.
- The ARC systems require use of an SSH-2 or later client; when using some Unix implementations, you will be required to use “ssh2” instead of “ssh” above.
- Inclusion of the account name is not required when the account names on the client and host machines are the same. For example, if the account you are using on your local system is the same as your account name on BlueRidge, you could simply enter: ssh blueridge1.arc.vt.edu
If you are using a Windows machine, you will need to download an SSH client, such as PuTTY or the SSH Secure Shell Client. PuTTY is available as a stand-alone executable as well as part of a Windows installer package that includes file transfer and other tools. The Secure Shell Client comes with a graphical file transfer tool.
After you download the software, run the Secure Shell Client installation program (exe) and respond to the on-screen prompts. When the installation is complete, you should have two icons for the Secure Shell Client and the Secure File Transfer Client on your desktop.
To configure and use the SshClient program, double click on its desktop icon. When you press the Enter key, a “Connect to Remote Host” Dialog box will appear. The first time you use the client, the two fields in this dialog box will be empty; enter the full “Host name” (e.g., blueridge1.arc.vt.edu for ARC system “BlueRidge”) and your “User name” (account name or user id) in the two fields on this screen; leave Port Number set at 22 and Authentication Method set as “Password”.
Click on the “Connect” button. The first time you connect to a new machine, the “Host Identification” dialog box will appear informing you that you had not previously connected to this machine and asking if you would like to save a host key in the local database of your machine. Click on “Yes” to continue. You will then be prompted to enter your password; do so and click on the “OK” button. You will then be connected to the host you have selected.
To verify that the backspace key is functioning properly, type some text on the command line and then press the backspace key to see if it functions as desired. If not, from the Edit menu, select “Settings”, and then select “Keyboard”; the keyboard settings dialog box will then appear. Select both “Backspace sends delete” and “Delete sends Backspace” in this dialog and then click on “OK”. Again test the function of the backspace key. If still does not function as expected, try selecting only “Backspace sends delete” or “Delete sends Backspace” and then testing if the backspace key is functioning as desired. Once the backspace key is working properly, you can save your settings by selecting “Save as” from the file menu and saving as an ssh2 profile; if you are only using ssh to access one computer, you can save the settings as “default.ssh2”, if you are using multiple machines, you may wish to save the settings for each machine as a separate profile and place a shortcut to each profile on your desktop or in the start menu.
This section describes how to move files between a location machine and an ARC System. To move or copy files within an ARC System (e.g., from one location on BlueRidge to another), use the cp or mv commands.
SCP and SFTP provide two easy ways to transfer files when working on an OS-X, Linux, or Unix machine. The scp command can be used at the command line to do a simple transfer of files, as described in the following table:
|scp local.txt email@example.com:myfolder/blueridge.txt||Copy the file local.txt on the local machine to the file myfolder/blueridge.txt on BlueRidge (for PID johndoe).|
|scp firstname.lastname@example.org:myfolder/blueridge.txt local.txt||Copy the file myfolder/blueridge.txt on BlueRidge (for PID johndoe) to the file local.txt on the local machine.|
The sftp command is used to create an interactive file transfer session. For example, to start an SFTP session with BlueRidge, enter the following at the command prompt (where johndoe is replaced by your username):
Enter your password when prompted. Then you can enter a series of commands to transfer files (note that most normal Unix commands, such as cd and ls apply to the remote computer):
|lpwd||Similar to pwd; prints the working directory on the local computer. (pwd prints the working directory on the remote computer.)|
|lcd||Similar to cd; changes the working directory on the local computer. (cd changes the working directory on the remote computer.)|
|lls||Similar to ls; lists the files in the working directory on the local computer. (ls lists files on the remote computer.)|
|lmkdir||Similar to mkdir; creates a directory on the local computer. (mkdir creates a directory on the remote computer.)|
|get blueridge.txt local.txt||Copy the file blueridge.txt on BlueRidge to the file local.txt on the local machine. If the second file name is omitted, the source file name is retained.|
|put local.txt blueridge.txt||Copy the file local.txt on the local machine to the file blueridge.txt on BlueRidge. If the second file name is omitted, the source file name is retained.|
When finished transferring files, type exit to terminate your SFTP session.
Windows users will have to download a program to do SFTP or SCP file transfers to a Unix system. Fortunately, most SSH Clients, such as PuTTY and the Secure Shell Client, have associated file transfer tools. Other tools, such as FileZilla, are available solely for file transfers.
The SSH client PuTTY has two associated file transfer programs, PSFTP and PSCP, which closely mirror the Unix commands SFTP and SCP, respectively. They can be downloaded from the PuTTY website, which also provides extensive documentation for each:
The Secure File Transfer Client comes with the Windows Secure Shell Client and provides a graphical interface for file transfers.
To configure and use the SSH Secure File Transfer Client program, double click on its desktop icon. When you press the Enter key, a “Connect to Remote Host” Dialog box will appear. The first time you use the client, the two fields in this dialog box may be empty; if so, enter the full hostname (e.g., blueridge1.arc.vt.edu) and your userid in the corresponding two fields on this screen; leave Port Number set at 22 and Authentication Method set as “Password”. Click on the “Connect” button. You will then be prompted to enter your password; do so and click on the “OK” button. You will then be connected to the host you have selected. A window consisting of two panes will be displayed: the leftmost pane contains the current directory of the local machine, the rightmost pane contains a list of the directories on the host machine (e.g., BlueRidge). You can then use the icons within these panes to navigate up or down each directory tree.
- To upload files, simply select them from left pane (e.g., your desktop) and drag them to the appropriate folder in the right pane (e.g., BlueRidge) of the SSH Secure File Transfer Window. Downloading files is accomplished by selecting files in the right pane and dragging to the left pane. Alternatively, you can upload a file (or files) to the currently selected folder of the Unix system by first selecting the upload (up pointing arrow) menu icon of the SSH Secure File Transfer Window’s Toolbar. An “Upload” dialog window will then appear displaying files on your local machine; select the file or files you wish to upload and then click on the “Upload” button. To download files by selecting the “Download” (down pointing arrow) menu icon.
- By default, “auto-select” transfer mode of the SSH Secure File Transfer Client is used to determine the best mode for uploading and downloading files based on the file extension. If the auto-select mode does not function appropriately for your files, you can specify the transfer mode to by used by selecting the “File Transfer Mode” option from the “Operation” menu — ASCII is appropriate for text files and BINARY is appropriate for images, PDFs, and other binary files.
After your userid and password have been verified, the message of the day (motd) will typically be displayed:
******************************************************************* * * * * * sample message of the day * * * * * *******************************************************************
The shell prompt (“$” is the default prompt for the Bourne, Korn Shell or BASH shells, “%” is the default C shell prompt) will be displayed and you may then enter Unix commands.
To log out of the system enter the command “exit” or press the Ctrl-D key sequence. You will then be returned to your prior working environment.
Note: Some userids are customized to prevent accidental logoff using the <Ctrl-D> key sequence. If <Ctrl-D> does not logoff your session, try entering the command “exit” or “logout”.
Note: If you are using a Unix workstation to access another Unix system, do not turn off the local workstation unless you are the system administrator for the local machine and follow the appropriate “shutdown” procedure.
Note: Unix operating systems are case sensitive.
Some keyboard characters have special meaning in the Unix environment; see Unix Special Characters for some of the most commonly used special characters.
Press the <Return> key (sometimes this key is labeled as “Enter” or with a large left pointing arrow) to execute Unix and user-written commands. Whenever<Return> appears in this section, press the key corresponding to this function. For example, to list the non-hidden files in the current directory:
The cat (conCATenate) command can be used to create or display the contents of files as well as to join files together. Use the following sequence of commands to create a file:
cat > my_first_file <Return> Here is a line of text. <Return> Here is a second line of text. <Return> Ctrl-D
To display the contents of the file just created, enter:
cat my_first_file <Return>
For the remainder of this guide, use of the <Return> key to execute Unix and user-written commands will be assumed and not included as part of the command syntax in the example exercises.
Ctrl key sequences are executed immediately and need not be followed by an <Return> to take effect.
Unix uses key sequences to execute commands such as deleting a character, terminating an executing command, and logging off. Some of the most important key sequences include (the first key sequence listed for each function is the default for many Unix systems):
- Erase previous character: For example, suppose you made a mistake and typed “lx” instead of “ls” and discovered you mistake prior to pressing the<Return> key. To backspace over the last character, you could press the <Ctrl-H> key sequence, that is, press the Ctrl (or Control key on some keyboards) and while it is depressed, press the h key:
Note: the stty command can be used to reassign the backspace function to another key; see Changing System Default Key Definitions.
- Delete (kill) the current line: For example, if the full line was entered incorrectly, it can be deleted in its entirety by using the <Ctrl-U> key sequence:
- Interrupt (intr) current command: This character is used to “interrupt” or “abort” many Unix commands.For example, suppose you had issued the man (display manual pages) command and decided to cancel it before it has finished executing:
man man <Ctrl-C>
Do not use <Ctrl-Z> to interrupt a command you wish to terminate; this control sequence is used suspend the current active process, but does not kill nor cleanup temporary files created by the process.
- end-of-fileThe end-of-file character has many uses. These include:
- Terminating programs
- You may exit many Unix commands and programs with this character.
- Terminating text entry
- For example, to end the text of a note that you are typing with the cat command, enter <Ctrl-D>.
- Logging out
- Press <Ctrl-D> at the Unix prompt to log out of the system in the traditional manner.
Note: Where more than one “key” is listed for a command, different Unix systems may use one or more keys to perform the indicated function. You need to be aware of the alternative keys for each function should you log onto another Unix system which does not use the set with which you are familiar.
Many commands are available to allow you to customize or modify the Unix environment according to your preferences. You may issue such commands after you are logged in to accomplish the changes you desire or place them in a customization file.
The stty command can be used both to display the current key definitions and to change them.
To display the current values of keyboard command sequences, enter:
On some systems, the -a option is not recognized. On these systems, try using the “all” option:
You can also use the stty command to change the key sequence designated to perform a selected command. For example, to assign “@” as the “kill line” character, enter:
stty kill @
If <backspace> does not already function to delete the preceding character, you can enable it to do so by entering:
stty erase <backspace>
where <backspace> is the key to which you wish to assign the backspace function.
Note: On some systems, you will receive an error message if you attempt to use the stty command to reassign a function to the key which currently performs a function.
If you are using the BASH, Bourne, or Korn shells (a “$” appears as the default command prompt), you can use the following pair of commands to assign “vt100” to the TERM environmental variable:
TERM=vt100 export TERM
Do not include spaces on either side of the equal sign. The variable name TERM is entered in all upper case.
If you are using the C shell (a “%” appears as the default command prompt), use the following command to assign vt100 to the TERM environmental variable:
setenv TERM vt100
You can also customize your environment by placing desired configuration commands in the file which is loaded by the command processor when you login.
When using the BASH shell, environmental configurations are typically stored in the files .bashrc and .bash_profile. Commands placed in these files will be executed the next time you log on; commands in .bashrc will be executed whenever a new BASH shell is started.
If you are using either the Bourne or Korn Shell as your command processor, you would add these commands to the file “.profile”. The next time you log in, “.profile” will be executed automatically, and the changes you have made will take effect.
If you are using the C shell (% as the default prompt) include your customization commands in “.login” or “.cshrc” file. The “.login” file is invoked once when you log onto the system and typically contains stty, setenv, and umask commands. The “.cshrc” file is invoked each time a new C Shell process is started and typically contains history, set, and alias commands.
In order to use X applications on a Unix system, you need to be running an X Windows System server on your local machine and allow X clients to display back to it.
Most Unix systems include an X Windows System server as part of their installed software and it may already be started as part of your systems GUI window manager when you log on. On OS-X systems, the X WIndows System server is not included as part of the default installation; if you wish to display X clients back to an OS-X system, you must first install the X-11 software and start your ssh connections from within an X-11 window. Otherwise, if your system does not start an X Windows System server when it boots up, consult with your System Administrator or the system documentation for information on how to initialize it.
Once you have initialized the X Windows System server on your local machine, use SSH to log onto the X Window System client machine, for example, to log onto Ithaca, you could use the command:
When an X client is initiated on Unix system, e.g., Ithaca above, the client output will then appear in a window on your local display. You can use the X client “xclock” to test if you have properly configured the connection between your X Windows Server and the host system:
- On SGI systems (e.g., Inferno, Inferno2, or Cauldron), use:
When you are finished with an X application, you can typically close the application by selecting “Quit” or “Exit” from the applications main window menu; otherwise, you can close the displayed X windows by using the mouse to select the close box or select the close window option from the appropriate menu.
- On Mac OS-X and some other Unix systems, include the -X option to enable the X Windows System to function with you SSH client, for example:
ssh -X email@example.com
- On Mac OS-X systems, make sure that you enter the ssh command in an X-11 window and not a terminal window.
Secure Shell Client
If you are using the Windows Secure Shell Client from a Windows machine, you will need to configure the client to enable use of the X Windows System. From the Profiles menus, select “Edit profile”, select your profile, select the “Tunnelling” tab, select the “TunnelX11 connections” check box, select “OK”, and from the “File” menu, select, “Save Settings”.
- Under Session in the left-hand menu, enter the Host Name (e.g., “ithaca.arc.vt.edu”).
- Under Connection in the left-hand menu, select SSH, then select X11. Check the “Enable X11 Forwarding” box.
- Under Session in the left-hand menu, enter a name for the session (e.g., “IthacaX11”) and click Save.
- Start the XServer on Windows.
- Double click on the saved session. Enter your username and password as requested. You should be able to run X applications from the host on your local desktop.