Prof. Federico Milano Email: federico.milano@ucd.ie Tel.: 01 716 1844 Room 157a - Electricity Research Centre School of Electrical, Electronic and Communications Engineering University College Dublin Dublin, Ireland Dublin, 2014 Intro Lab 1 Working with a Unix Server - 1 Connecting from Windows The connection to a Unix Server from a Windows OS can be done using a connection protocol. In our case, the Unix server allows only ssh and sftp protocols. Hence we need tools that provide such protocols. Dublin, 2014 Working with a Unix Server - 1 Unix Terminal The ssh protocol is a cripted tunnel that allows connecting to a Unix terminal. A terminal is basically a window where the user inputs instructions through a command line. A Unix terminal is similar but way much powerful than the Windows command prompt. Dublin, 2014 Working with a Unix Server - 2 How a Unix Terminal Looks Like Dublin, 2014 Working with a Unix Server - 3 SSH Clients To connect to a terminal through SSH, we need a SSH Client. On Windows, a SSH Client is simply a program that opens a Unix terminal once login information are provided. There are several SSH Clients for Windows. Some of them are free software. Dublin, 2014 Working with a Unix Server - 4 SSH Client: Putty Dublin, 2014 Working with a Unix Server - 5 SSH Client: Putty Dublin, 2014 Working with a Unix Server - 6 SSH Client: Putty Dublin, 2014 Working with a Unix Server - 7 Login using an SSH Client Username Write your username. The user name is the initial of your rst name plus your rst surname, all lower case. Example: John Smith jsmith Dublin, 2014 Working with a Unix Server - 8 Login using an SSH Client Password Press enter and then write your password. The password is a random sequence of 8 digits: Example: 031SAsfd Note that, for security reasons, your password will not be displayed while typing. Please do not change your password! Dublin, 2014 Working with a Unix Server - 9 SSH Client: Putty Dublin, 2014 Working with a Unix Server - 10 Limitations of SSH Clients for Windows While Unix terminal is a very powerful tool, Windows limits a bit its functionalities. For example, no windows can be open from the terminal. You are thus limited to the command line. This is not really an issue as, Unix, almost everything can be done from the command line. Dublin, 2014 Working with a Unix Server - 11 SFTP Clients The terminal allows operating on the server, but it is necessary to be able to exchange les from the server to the local system and from the local system to the server. This operation can be done using SFTP clients. Again, there is plenty of choice of SFTP clients for Windows. Some of them are free software. Dublin, 2014 Working with a Unix Server - 12 SFTP Clients On the module website two SFTP clients are available: CyberDuck: it provides a user-friendly GUI, but it may not work on desktop computers of the lab. PSFTP: only command line but it works on desktop computers of the lab. Dublin, 2014 Working with a Unix Server - 13 SFTP Client: CyberDuck Dublin, 2014 Working with a Unix Server - 14 SFTP Client: CyberDuck Dublin, 2014 Working with a Unix Server - 15 SFTP Client: CyberDuck Dublin, 2014 Working with a Unix Server - 16 SFTP Client: CyberDuck Dublin, 2014 Working with a Unix Server - 17 SFTP Client: PSFTP Dublin, 2014 Working with a Unix Server - 18 SFTP Client: PSFTP PSTFP is a very light and simple SFTP client but requires to learn its commands. The use of PSFTP can be efcient once Unix commands are properly handled. Type help to display the list of SFTP commands. Dublin, 2014 Working with a Unix Server - 19 SFTP Client: PSFTP Dublin, 2014 Working with a Unix Server - 20 Create and Editing Files on Unix Apart from transferring le to and from the server, it can be useful to edit les directly on the server. This can be done in several ways, but using a SSH client, you are limited to command line editors. A possible choice is nano that can be launched from the prompt of the Putty terminal. Dublin, 2014 Working with a Unix Server - 21 Command Line Text Editor: Nano Dublin, 2014 Working with a Unix Server - 22 Being Efcient with SSH and SFTP Clients Some tips to be efcient when dealing with SSH and SFTP clients. Open an SSH client. This will be the terminal for main operations (e.g., executing power ow) Open an SFTP client to move les from and to the server. Open another SSH client for auxiliary operations (e.g., editing les on the server) Open as many SSH clients are you need and dedicate each one to a specic, simple operation. Dublin, 2014 Working with a Unix Server - 23 Hints and Warnings Unix does not forgive errors. For example if you remove (delete) a le, that le is lost forever. The server is not a backup disk. You may loose everything due to server maintenance operations. The server is quite robust and student-proof, but if you mess up the server all other users will be affected. Hence, please always think twice before launching a command. If your connection is slow, do as much operations as possible on your local computer and use the server only for number crunching. You can connect to the server from anywhere (e.g., home and Starbucks). Dublin, 2014 Working with a Unix Server - 24 Exercises Do all exercises (except for exercises 5.3 and 6.x) of the Unix Tutorial available at http://faraday1.ucd.ie/archive/software/unix.pdf Moreover, do the following exercises: 1. Open a SSH connection using your account. 2. Open a SFTP connection using your account. 3. Create a text le on your computer and copy it to the server. 4. Edit the text le on the server using nano. 5. Copy back your edited text le on your local computer and check that changes have been applied. Dublin, 2014 Working with a Unix Server - 25 Links Web page of the course: http://faraday1.ucd.ie/modules/control.html Blackboard: https://elearning.ucd.ie Dublin, 2014 Working with a Unix Server - 26