Introduction to Lab Practicals (Lab Intro 3) Access Control, Synchronisation and Remote Access

Similar documents
Introduction to Lab Practicals (Lab Intro 3) Access Control, Synchronisation and Remote Access

CS Fundamentals of Programming II Fall Very Basic UNIX

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Working with Basic Linux. Daniel Balagué

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Exploring UNIX: Session 3

Exercise Sheet 2. (Classifications of Operating Systems)

COMP519 Practical 5 JavaScript (1)

Introduction to the Linux Command Line

Introduction: What is Unix?

A Brief Introduction to the Linux Shell for Data Science

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface

Chapter-3. Introduction to Unix: Fundamental Commands

CISC 220 fall 2011, set 1: Linux basics

Linux at the Command Line Don Johnson of BU IS&T

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Practical Session 0 Introduction to Linux

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Part I. Introduction to Linux

Unix basics exercise MBV-INFX410

COMP284 Practical 6 JavaScript (1)

Permission and Ownership

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Getting started with Hugs on Linux

Introduction to Linux for BlueBEAR. January

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

Linux File System and Basic Commands

1. What statistic did the wc -l command show? (do man wc to get the answer) A. The number of bytes B. The number of lines C. The number of words

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

Introduction to Linux Workshop 1

Introduction to Unix: Fundamental Commands

Exercise 1: Basic Tools

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

CSCE 212H, Spring 2008, Matthews Lab Assignment 1: Representation of Integers Assigned: January 17 Due: January 22

UNIX Quick Reference

Lab 1 Introduction to UNIX and C

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

Getting Started With UNIX Lab Exercises

Introduction to Linux

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1

Mills HPC Tutorial Series. Linux Basics I

Unix. 1 tblgrant projects 0 Jun 17 15:40 doc1.txt. documents]$ touch doc2.txt documents]$ ls -l total 0

1Z Oracle Linux Fundamentals (Oracle Partner Network) Exam Summary Syllabus Questions

Files

CENG393 Computer Networks Labwork 1

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Unit: Making a move (using FTP)

System Administration

Operating Systems, Unix Files and Commands SEEM

The Linux Command Line & Shell Scripting

Lab 1: Introduction to C, ASCII ART & the Linux Command Line

Introduction. File System. Note. Achtung!

How to Create a NetBeans PHP Project

Getting started with Hugs on Linux

INSE Lab 1 Introduction to UNIX Fall 2017

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

PROGRAMMAZIONE I A.A. 2015/2016

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window.

Open up a terminal, make sure you are in your home directory, and run the command.

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12)

COMP284 Practical 3 Perl (3)

CS 460 Linux Tutorial

commandname flags arguments

CS246 Spring14 Programming Paradigm Notes on Linux

Week 2 Lecture 3. Unix

Welcome. IT in AOS. Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University. September 21, 2012

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

1 Installation (briefly)

Introduction to Linux

Short Read Sequencing Analysis Workshop

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

Tutorial 1: Unix Basics

Once you have installed MobaXterm, open MobaXterm. Go to Sessions -> New Session, and click on the SSH icon.

CSC209. Software Tools and Systems Programming.

Introduction to Linux

LAB #5 Intro to Linux and Python on ENGR

Linux Tutorial #6. -rw-r csce_user csce_user 20 Jan 4 09:15 list1.txt -rw-r csce_user csce_user 26 Jan 4 09:16 list2.

Basic Survival UNIX.

COMP284 Practical 1 Perl (1)

Introduction to Linux

CS/CIS 249 SP18 - Intro to Information Security

Introduction to Unix and Linux. Workshop 1: Directories and Files

Oxford University Computing Services. Getting Started with Unix

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

Exercise sheet 1 To be corrected in tutorials in the week from 23/10/2017 to 27/10/2017

Links, basic file manipulation, environmental variables, executing programs out of $PATH

15-122: Principles of Imperative Computation

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Computer Systems and Architecture

Network Administration/System Administration (NTU CSIE, Spring 2018) Homework #1. Homework #1

IT341 Introduction to System Administration. Project 4 - Backup Strategies with rsync and crontab

Transcription:

Introduction to Lab Practicals (Lab Intro 3) Access Control, Synchronisation and Remote Access 1 Introduction This practical is intended to familiarise you with the file access control mechanisms of Linux file systems. By default, your own files can only be accessed by yourself. It is important that you understand why this is so, how you can check who can access your files or the files of others, how you restrict or open access to files, and how you change what can be done with a file. In addition, we will consider how you might best synchronise the files on the Departmental filestore with the files you have at home on a PC or laptop and how you can remotely access Departmental computing facilities. This document can be found at http://intranet.csc.liv.ac.uk/ ullrich/comp284/notes/comp284intro03.pdf While you work through the tasks below compare your results with those of your fellow students and ask one of the demonstrators for help and comments if required. 2 File Permissions We will use the Department s Linux servers for most of the exercises that follow. Use MobaXterm to connect to one of the departmental Linux servers. 2.1 Overview You have already seen that using ls -l you can get a long listing of the files in the current directory. If you have completed the exercises of Lab Intro 2, then your home directory should contain a subdirectory called COMP284 and several files including out3.txt and winfile.txt in that subdirectory. If you have used names different from these, then you need to adjust the exercises accordingly. Executing the commands ls -l ls -l COMP284 Figure 1: Permissions should result in output resembling that shown in Figure 1 (remember: l is the letter l, not the number 1 ). As you can see, the output of ls -l consists of several columns with the right-most column obviously containing the names of files and directories. The third column from the left, the one containing scac982 in Figure 1, indicates the owner. For your own files, the corresponding column should show your username. The fourth column from the left, the one containing a string like $3qj600-lkmjghg7t0fg in Figure 1, indicates the group. Again, the group shown for your files will be different. A group is a collection of users/accounts and any user/account belons to one or more groups. The left-most column, a rather cryptic looking string of characters and dashes, shows the permissions (alternatively called access rights) for each of the files and directories. 1

All modern operating systems use access control lists to control who can do what with a particular file system object. To this end, each file system object is associated with such an access control list that contains access control entries, each of which gives an individual user or group the right to perform an operation such as reading, writing, or executing the file system object. Linux, like any traditional UNIX operating system, recognises three classes of users with respect to operations on file system objects: owner, group, and other. Operations are categorised as read (r), write (w), and execute (x). Finally, the file system categorises file system objects into various kinds of objects, including files and directories. Having read (r), write (w), and execute (x) permission takes slightly different meaning for files versus directories: Permission For a file For a directory read (r) allowed to view file contents allowed to view directory contents write (w) allowed to write to file allowed to remove or add new files to directory execute (x) allowed to execute file allowed to access files in the directory Some clarification is in order regarding permissions for directories: To remove or add a file to a directory, or to otherwise modify an already existing file in a directory, you actually need both write (r) and execute/access (x) permission for the directory. Similarly, while read (r) permission for a directory, without execute (x) permission, does indeed allow you to see what files are in a directory, you will get an error message for each file telling you that you do not have access permission for the file. Furthermore, you will not be able to see any additional information for these files, e.g. their owners or the permissions for these files. So, what does the information shown in Figure 1, and partially repeated below, tell us about permissions for the files and directories involved? drwxr-xr-x. COMP284 -rw-r--r--. out3.txt -rwx------. winfile.txt The first character indicates the type of the file: d stands for directory, - for regular file, l for link, etc. So, COMP284 is a directory, while out3.txt and winfile.txt are regular files. The next block of three characters indicates the permissions that the owner of the files has. So, rwx for COMP284 and winfile.txt means that the owner has read, write and execute permission. Remember, since COMP284 is a directory while winfile.txt is a regular file, these permissions have a slightly different meaning for each of these. For out3.txt, rw- indicates that the user has read and write permission, but not execute permission. The next block of three characters indicates the permissions for members of the group. For COMP284, the three characters are r-x, so the group has read and execute permission for this directory but not write permission. For out3.txt, the three characters are r--, so the group has read permission. Finally, for winfile.txt, the three characters are ---, so the group has no rights with respect to this file. The next block of three characters indicates the permissions for other users. As it happens, for the three file system objects considered here, as the third block of three characters is identical to the second block of three characters, other users have the same permissions as the group. 2

2.2 Changing File Permissions: Symbolic Notation To change the permissions for file system objects you use the chmod command. In is simplest form, chmod takes two arguments: 1. A description of the permissions that you want to set or a description of how you want to change the existing permissions. This description can be given in symbolic notation or numeric notation. (a) In symbolic notation, you need to specify for which user or group of users you want to change the permissions, how you want to change them, and which permissions you want to change: Which user? How to change the permission? Which permission? u user/owner + add this permission r read g group - remove this permission w write o other = set exactly this permission x execute a all (of the above) For example, u-x indicates that you want to remove the execute permission from the owner, i.e. from yourself, while a+w means that you want to add write permission for all users, including yourself. Regarding the first and third group, you can pick more than one character. For example, ug+rw means that for both user/owner and group you want to add both read and write permission. 2. A list of file system objects for which you want to change the permissions, with a space separating the files system objects within the list. Putting both together, chmod u-x ~/COMP284/winFile.txt removes execute permission from the owner of the file ~/COMP284/winFile.txt. Execute the command above and use ls -l ~/COMP284 to see what the effect of the command has been. The output from ls -l ~/COMP284 should resemble that shown in Figure 2: The permissions for the owner of the file should have changed from rwx to rw-. In Figure 1 we have seen that the permissions for the file out3.txt give read permissions to all users (owner, group, and others). Such generous read permissions should be avoided if at all possible as you are required to keep your files secure from Figure 2: chmod (1) unauthorised access 1. 1 For example, if a file that is readable by all users would contain your work for a COMP284 assignment, then all students could potentially see what you have done and one of them could submit a copy as their own work. We would consider that to be collusion involving both parties, i.e. yourself and the other student, not plagiarism. 3

To restrict the read permissions for out3.txt use the command chmod og-r ~/COMP284/out3.txt and see what the effect is using ls -l ~/COMP284 (see Figure 3). Let us see what the default permissions are for a newly created file. To create such a file you can use the touch command: touch ~/COMP284/newFile.txt will create a new file called newfile.txt in the directory COMP284. Figure 3: chmod (2) Execute this command and use ls -l ~/COMP284 to see what the permissions for newfile.txt are (see Figure 4). As you can see, the file is readable and writable by the owner, i.e. yourself, and also readable by group and world. If you were to create a new file under Windows, then by default the execute permission would also be set. So far we have not seen an example of an executable file. Let us create one. Figure 4: chmod (3) Using your favourite editor, e.g. gedit, create a new file in your home directory, called myfirstshellscript, with the following content (also see Figure 5): #!/bin/sh echo "Hello World!" Here, the first line indicates which interpreter should be used to execute the rest of the file, namely, the file /bin/sh, the system s default shell. That will be the GNU Bourne-Again SHell or bash for short. Check with ls -l what the permissions are for the file Figure 5: Shell script myfirstshellscript once you have saved it. Not surprisingly, it is readable and writable by the owner, but nothing else. Try to execute the file by using the command./myfirstshellscript in the same directory where this file is stored. You should get an error message telling you that you do not have permission to execute the file. This is correct as so far nobody has execute permission for this file. Figure 6: Executing files Let us change that using the command chmod u+x myfirstshellscript Then try to execute myfirstshellscript again. This time you will succeed and the script will produce the output Hello World! See Figure 6. Now that you know how to change the permissions of a file system object, you can check whether what has been said on page 2 about permissions for directories is true. Do the following: 4

1. Make sure that the working directory is your home directory. 2. Change the permissions for directory COMP284 to r--------, i.e. read permission for the owner only, no other permissions for the owner, no permissions for group or other. Then use ls -l ~/COMP284 to see whether you can still obtain a long listing of the contents of the COMP284 directory. 3. Now give yourself execute permission for COMP284 in addition to read permission, i.e. set the permissions to r-x------. Use ls -l ~/COMP284 again to see what the long listing of the contents of the COMP284 directory looks like. 4. Next, see whether write permission alone allows you to create a file in the the directory COMP284. To do so, execute the commands chmod u=w ~/COMP284 touch ~/COMP284/testFile The system should deny you the permission to create testfile. 5. Adding execute permission to the directory should solve this problem: chmod u+x ~/COMP284 touch ~/COMP284/testFile This time creating the file testfile should succeed. 2.3 Changing File Permissions: MobaXterm If your files happen to be on a system that can be accessed remotely using MobaXterm, as the files on the Departmental filestore are, then MobaXterm provides you with an easy-to-use graphical interface to manipulate file permissions. 1. Open MobaXterm and connect to the Linux server. 2. In the file browser in the left pane of MobaXterm navigate to the directory COMP284, right-click on the file newfile.txt that you have created in one of the previous exercises. MobaXterm shows you a context menu and among the operations that you can perform is one called Permissions (Figure 7a). Select it. (a) Contex menu for files (b) File permissions menu for files (c) Confirmation of change Figure 7: Changing File Permissions using MobaXterm 5

3. You then see a table that shows you what the current file permissions for newfile.txt are (Figure 7b). You see that the file is readable by user, group and others (world-readable). By clicking on a particular cell you can add or remove permissions. Remove read permissions from group and others, then click Apply. 4. MobaXterm will ask you for confirmation (Figure 7c). Confirm that you want the changes to be applied. 5. Check in the terminal window of MobaXterm that the file permissions have changed as intended by executing the command ls -l ~/COMP284/newFile.txt 6. It is worth pointing out that MobaXterm determines the file permissions of each file in a folder when the folder is first opened in the file browser. So, if you change permissions on the command line then MobaXterm might not pick up those changes. Use the Refresh folder function of the file browser to make sure that MobaXterm shows you up-to-date information. 3 Creating Web Pages Each of the COMP284 assignments will ask you to develop a web-based application. We therefore need to explore the basics of how you use departmental facilties to creating such applications, starting with something as simple as a web page. a. Create a directory ~/public_html/ using the command mkdir $HOME/public_html Here HOME is an environment variable that stores the path to your home directory and $HOME returns the value of that variable. b. Open a text editor of your choice and enter the following HTML markup: <!DOCTYPE html> <html> <!-- File: page01.html Creation: 2018-10-02 Description: introductory page --> <head> <title>my first HTML document</title> </head> <body> <p>hello world!</p> </body> </html> You can also cut and paste the markup from the PDF file, but if you do so, make sure that in this process no extra spaces are introduced into the markup. c. Save the HTML markup to a file named page01.html in your public_html directory. 6

d. Now we have to make sure that the permissions for various directories and files is set correctly, so that the departmental web server can access them but nobody else can. In particular, your home directory and the public_html directory must be world-readable and world-executable, while the HTML file must only be readable by yourself. You can set the permissions correctly using the commands chmod a+rx ~/ chmod a+rx ~/public_html/ chmod og-rwx ~/public_html/page01.html e. Open a web browser, i.e. Google Chrome or Mozilla Firefox, and access the URL http://student.csc.liv.ac.uk/~<user>/page01.html where you need to replace <user> with your username. Figure 8 shows you what you should see. If this does not work for technical reasons, then on the Windows side, locate page01.html in a file manager and open it with a web browser. f. The web browser can show you the HTML markup it is rendering. For example, in Google Chrome, right-click somewhere on the web page and select the option View page source in the menu that opens; in Mozilla Firefox, right-click somewhere on the web page and select the option View Page Source. A new tab should open in the web browser showing your HTML markup. For page01.html you should see exactly the contents of the file page01.html. Later, when we move on to dynamic web pages, you will find that this correspondence no longer holds. 4 Synchronisation You may have your own PC and/or laptop that you want to use for your studies, in which case you will have to transfer files between the Departmental filestore and your PC/laptop. You might use a USB pen drive, but students quite often forget these, or forget to copy all the necessary files onto the pen drive, or the pen drive gets lost or ceases to work. An alternative is the use of MobaXterm or rsync to transfer files between a PC or laptop at home and the departmental computers. 4.1 MobaXterm We have already mentioned in the last practical that MobaXterm also allows you to transfer files. Let us quickly see how that works. First, create new directories and files using the commands Figure 8: Your first web page in a web browser 7

(a) Download file (b) Upload file Figure 9: Transferring files using MobaXterm mkdir -p ~/uni/comp284 ls -1 $HOME > ~/COMP284/fileUni.txt ls -1 $HOME > ~/uni/comp284/filehome.txt The directory ~/uni/comp284 serves as a stand-in for your personal PC/laptop. We want to transfer fileuni.txt to ~/uni/comp284/ using MobaXterm. To do so, in the file browser in the left pane of MobXterm, find the directory COMP284, double-click on it to open the directory in the file browser. Then right-click on the file fileuni.txt. This opens a menu (Figure 9a) in which you select Download. Another file browser opens which allows you to select the directory to which you want to download the file to. Use the file browser to select the directory ~/uni/comp284/. To upload the file filehome.txt to the directory ~/COMP284/, first select this directory in the file browser of MobaXterm. Then click on the upward arrow above the file browser pane. Again, another file browser opens which allows you to select the file or files that you want to upload. Use the file browsers to select the file filehome.txt, then click on Open (Figure 9b). MobaXterm will then transfer the file. Explore the other options that MobaXterm offers you: You can create directories on the remote system. delete files, and create new files. 4.2 rsync rsync is a program that transfers files and directories from one location to another in a way that minimises the amount of data that needs to be transferred. The two locations do not necessarily have to be on the same computer. rsync has several advantages over other, simpler, file transfer programs: (i) rsync can restrict transfers to files that have been changed instead of blindly transferring all files and (ii) even where a file has to be transferred, rsync will by default only transfer parts of the file that have changed, not the complete file. This not only minimises the amount of data that needs to be transferred but also minimises the time the transfer takes. The protocol that is typically used for the transfer of files between locations on different computers is SSH (Secure Shell), a cryptographic network protocol. SSH uses the client-server model and requires that on the computer that will act as server for the transfer of files is running a SSH daemon that accepts connections from a SSH client. This is the case for all Linux servers in the Department and the server lxfarm.csc.liv.ac.uk is pecifically set up to be accessible from outside the Department. Let us first assume that your PC/laptop at home is also using a Linux operating system. In all likelihood rsync will already be installed, if not, use the Package Manager to install it. Let us also assume that your username is sgxyz. Finally, assume that on the Departmental filestore you have all currently relevant files in a subdirectory COMP284 of your home directory while on your 8

own PC/laptop the corresponding files are in ~/uni/comp284/. Then to synchronise the contents of these two directories and all their subdirectories, execute the following command in a terminal window on your PC/laptop at home: rsync -auvz -e ssh sgxyz@lxfarm.csc.liv.ac.uk:comp284/ ~/uni/comp284/ sgxyz@lxfarm.csc.liv.ac.uk s password: After you have entered your Departmental password, modified files will be transferred, for example: receiving incremental file list winfile.txt out3.text sent 614 bytes received 278252 bytes 17991.35 bytes/sec total size is 893970880 speedup is 3205.74 The options -auvz -e ssh tell rsync: to transfer files in archive mode (-a), which ensures that symbolic links, devices, attributes, permissions, ownerships, etc are preserved in the transfer, to skip files that are newer on the receiver (-u), to show which files are transferred (-v), to compress the data that is to be transferred (-z) and to use ssh as network protocol (-e ssh). Used in this way, rsync does not delete files on the receiver, i.e., your PC/laptop, that have been deleted on the Departmental servers. In order to delete those files on the receiver, the --delete option can be used: rsync --delete -auvz -e ssh sgxyz@lxfarm.csc.liv.ac.uk:comp284/ ~/uni/comp284/ Obviously, this operation can easily lead to the loss of files. To see which files will be deleted on the receiver, without them being deleted right away, one can ask rsync to perform a dry run by adding the -n option to the command: rsync -n --delete -auvz -e ssh sgxyz@lxfarm.csc.liv.ac.uk:comp284/ ~/uni/comp284/ receiving incremental file list deleting winfile.txt sent 23 bytes received 18445 bytes 7387.20 bytes/sec total size is 417446325 speedup is 22603.76 (DRY RUN) Finally, if you have changed files on your PC/laptop and want to transfer those files back to the Departmental servers, you simply have to swap destination and source when using rsync: rsync -auvz -e ssh ~/uni/comp284/ sgxyz@lxfarm.csc.liv.ac.uk:comp284/ The only drawback of rsync is that you must not forget this step if you want continue to work on those files while in the Department. The manual page for rsync provides lots of additional information including a description of all the options of rsync. To experiment with rsync right now, do the following: 1. Execute the command rsync -auvz -e ssh sgxyz@lxfarm.csc.liv.ac.uk:comp284/ ~/uni/comp284/ replacing sgxyz with your own username and making adjustments to the directory names as necessary. 9

2. Inspect the contents of ~/uni/comp284. Does it now contain all the files and subdirectories of ~/COMP284? Compare the file permissions and modification times of those files and subdirectories with those of the sources files and subdirectories. 3. Change the modification time of ~/COMP284/out3.txt and add a new file ~/COMP284/files.txt by executing the commands touch ~/COMP284/out3.txt ls -l ~/COMP284/ > ~/COMP284/files.txt 4. Execute the command rsync -auvz -e ssh sgxyz@lxfarm.csc.liv.ac.uk:comp284/ ~/uni/comp284/ again, with the necessary modifications. See what files are transferred. 5. Create a file ~/uni/comp284/definition.txt by executing the command cp ~/uni/comp284/out3.txt ~/uni/comp284/definition.txt 6. Use a dry-run of rsync to see what were to happen if you sync ~/uni/comp284 back to ~/COMP284: rsync -n -auvz -e ssh ~/uni/comp284/ sgxyz@lxfarm.csc.liv.ac.uk:comp284/ 7. Finally, use another dry-run of rsync to see what were to happen if you sync ~/COMP284 with ~/uni/comp284 with the --delete option: rsync -n --delete -auvz -e ssh sgxyz@lxfarm.csc.liv.ac.uk:comp284/ ~/uni/comp284/ You should see that ~/uni/comp284/definition.txt would be deleted. 8. Delete the directory ~/uni/ directory and its contents. Let us now assume that your PC/laptop at home is using MS Windows. Then you first need to install rsync. There are various ports of rsync to MS Windows. We will use Grsync for Windows in the following. The installation file for Grsync is available for download at http://grsync-win.sourceforge.net/ Grsync provides a graphical user interface for rsync. After the installation of Grsync has been completed, it can be started from the Start Menu, and it presents itself as shown in Figure 10. Grsync provides two input fields that are used to specify source and destination. The syntax for the specification of remote sources is the same as for rsync. So, as in our examples for the use of rsync on Linux servers, in order to transfer files from subdirectory COMP284 in your home directory on the Departmental servers, you would specify the source as sgxyz@lxfarm.csc.liv.ac.uk:comp284/. To specify the destination directory, simply click on the Browse button to the right of the destination input field and navigate to the desired directory in the file selector window that opens. In order the specify whether permissions and ownership should be preserved and whether files present on the destination but not on the source should be deleted, Grsync provides check boxes. Make sure that the right options are set, in particular, that Skip newer is set. The graphical user interface will invoke rsync once you press the Execute button, pressing the Simulation will start a dry run. Two additional windows will open, one showing the progress of the synchronisation process, another asking you to enter your password for the Departmental servers. Once the password has been entered and accepted, the progress window will show diagnostic output by rsync. 10

Figure 10: Grsync for Windows Note that Grsync is also available for Linux servers. Again, if Grsync is not already installed on your PC/laptop, use the Package Manager to do so. For further help on the use of both the Windows and the Linux port of Grsync it is best to refer to the manual pages for rsync. 5 Remote access The Linux server lxfarm.csc.liv.ac.uk also provides you with a possibility to remotely access Departmental computing facilities. If your own PC/laptop is running Linux and has SSH installed, then executing the command ssh lxfarm.csc.liv.ac.uk in a terminal window will establish a secure terminal session to lxfarm. MacOS also comes with its own implementation of SSH and the command shown above should also work under MacOS. If your own PC/laptop is running MS Windows, you will first have to download and install an SSH client. Two alternatives are MobaXterm and PuTTY, with MobaXterm being the preferred alternative. You can find these at http://mobaxterm.mobatek.net/download-home-edition.html https://the.earth.li/ sgtatham/putty/0.70/w64/putty-64bit-0.70-installer.msi After installing a SSH client, you can access one of the Linux servers from home just as you did from one of the lab PCs. Note also that if you are using MobaXterm at home, you can interact with the Linux server that you are connected to from a laptop or PC at home in the same way as you can from a Windows system on campus. So, you can remotely edit files or upload files that you have created at home and you can execute commands on the departmental Linux servers. The best way of working remotely will depend on the speed and reliability of your internet connection. If your connection is fast enough, then you might be able to open an editor with graphical user interface on lxfarm.csc.liv.ac.uk and edit files directly on our systems. With a slower connection you might want to use a command line editor instead. Note that you can have more than one connection / terminal open at the same time. So, you can have one terminal with a command line editor and other terminal to execute commands such as compiling and running programs. The third alternative would be to just use the connection to transfer files that you create on your system. 11

apropos aspell bash cat cd chsh clear cp date diff diffpp egrep enscript find history kill ln mv quota rename sort ssh tail tar tcsh time top uptime vim zile zip 6 Further Study Table 1: Useful Linux commands This concludes our short introduction to Linux. There is obviously still a lot to learn, even about the commands that you have used in these practicals. To explore the possibilities of Linux further you can first of all take advantage of the manual pages that are available for almost every Linux command. In a terminal, manual pages can be read using the command man. In its simplest form man takes a single argument, namely, the name of the manual page that you would like to read; the name of the manual page is typically identical to that of the corresponding command or program. So, for example, man chmod will show you the manual page for the command chmod. To display this manual page, man uses less -s by default. So, you can use the key bindings for less to navigate through a manual page. Of course, you can use man less to learn what those key bindings are. Table 1 lists a number of other commands that you should explore by reading their manual pages and experimenting with them. To learn more about the Linux command line and shell scripting you can refer to the following e-book available from the library: W. E. Shotts: The Linux command line: A complete introduction. No Starch Press, 2012. http://library.liv.ac.uk/record=b2626812 S8 [last modification 16 December 2012, accessed 02 October 2015] 12