Introduction
Links to the sections of today's work
FTP and
Data Transfer Rates
TELNET
SSH
Chmod Command
Help
for
Completing the Lab Work
The object of today's laboratory work is to compare different methods of accessing remote computers, the data rates involved during the transfer and the facilities offered by these methods.
What work must I complete for my
mark?
Method - FTP and Data Transfer Rates
Log into your Windows account with the university.
Access a command prompt (DOS shell) via Start, Programs, Accessories, Command Prompt.
ftp (then press Enter)
At this point the command line prompt has changed to ftp>
Now type:
open newzeus.gre.ac.uk (then press Enter)
You will now be prompted to enter your user name e.g. ab123 (then press Enter)
You will now be prompted to enter your password. NOTE - if you have changed your password on the Windows system, it may NOT have been changed automatically on the newzeus machine. You will need your original password to access newzeus. If you have forgotten your original password, Computing Services will be able to tell you what it is if you show your Student Identity Card.
Once you have entered your correct password, you
will
be logged into the newzeus machine.
ftp> open
newzeus.gre.ac.uk
Connected to
newzeus.gre.ac.uk.
220 newzeus
FTP server ready.
User
(newzeus.gre.ac.uk:(none)): cm34
331 Password
required for cm34.
Password:
230 User cm34
logged in.
ftp>
If you have reached this point, then you should
begin making notes of your activity.
Important. You will see 21 questions below this point marked in red. You must answer all of these questions for your work today.
Now that you are logged in to newzeus, type the following command:
pwd (then press Enter)
newzeus will then reply.
1. Make a note of the reply from newzeus. What do you think pwd stands for?
Now type:
close (then press Enter)
This has terminated your connection to newzeus.
2. What is the current command line prompt?
Now type:
help (then press Enter)
[Note that from this point I will not write then press Enter after commands, I will assume that you can remember to press Enter!]
3. Make a note of the result of issuing the help command as displayed to your monitor. [how do I do this?]
Which of these commands do you think allows you to log out of the ftp program?
Below is a listing that I obtained when logging into newzeus
Log out of the ftp program.
Change to the G drive by typing G: at the command prompt.
Return to Windows. Using Notepad, open a new file and type:
the cat sat on the mat
Save this file to the G drive as cat.txt
[Note that some PC
configurations may not allow you to save files directly to the G drive.
If this is the case, you should save the file to your desktop and move
the file to the G drive separately using Windows Explorer]
4. How big, in bytes is the file cat.txt that you have created?
You can calculate this by counting the number of characters in the file. Each character of the sentence (including spaces) is represented by one byte.
Use Windows Explorer to find how big this file is. Does Explorer agree with your calculated answer? If not, why not?
Now return to the MSDOS prompt. [how do I do this?]
Log in to newzeus using FTP again. [how do I do this?]
When you have logged in to newzeus, type
put cat.txt
At
this point this message may appear - why might this be? Click OK.
5. Make a note of the response you received from newzeus. You can select text from the MSDOS shell and paste it into other applications. [how do I do this?]
6. What has the put command done? If you cannot yet work this out, type ls at the ftp> prompt. [Note that the ls command is lowercase L for love, not the number 1]
Now create a much larger file to transfer to newzeus. Use pbrush.exe to create a 24-bit colour file 640 x 480 pixels. [how?] Save this file as screen.bmp.
7. Now calculate the size of this file (in bytes) given that 24-bit colour uses 3 bytes per pixel. [what is a pixel?] Compare your result with that of the properties of the file in Windows Explorer. Did your calculation give the same answer? If not, think of a reason for any difference.
By the time you return to the ftp prompt you may have been automatically disconnected. To regain entry you will have to log in to newzeus from the beginning.
Type:
put screen.bmp
8. Make a note of the response you received from newzeus.
9. You will also see a data rate in the response from newzeus. Make a note of this too.
10. Calculate the data transfer rate in bytes per second from the information given in the response from newzeus. This is achieved by dividing the file size (in bytes) by the time taken for the transfer (in seconds). Now express the data transfer rate in bits per second.
11. Divide your answer by 1000 to obtain a data transfer rate expressed in kbits per second. Is this the same as the data rate in Q9? If not, think of a reason why this is different.
A standard ADSL connection to an ISP has a maximum data transfer rate of 500 kbits per second.
12. How many times faster than a standard modem is your connection to newzeus?
Rename the screen.bmp file on newzeus by typing:
ren screen.bmp screen2.bmp
Now fetch a copy of screen2.bmp by typing:
get screen2.bmp
13.
Make
a note of the response from newzeus and re-calculate the transfer
rate
in bits and kbits per second. If there is any difference in the rate
you
calculated in sending the file to newzeus, suggest a reason for the
difference.
Logout of newzeus.
Access a command prompt (DOS shell) and at the command prompt type:
telnet newzeus.gre.ac.uk
Make a note of the response. Which port was the
connection trying? Suggest a reason why TELNET connect failed.
Click on Quick Connect and enter the information as
shown below.
You will see the Host Identification dialogue as shown below. Make a note of this and ask yourself why we have been asked this question.
Click Yes.
You will be prompted for your password. Once you have entered this information you will be granted access to newzeus.
Type:
ls (Note that this command is ls, not is, not 1s either) l is for lemon,
14. What has this displayed?
Type:
ls -l (don't forget the space between the s and the - and also l for lemon, not the number 1!)
15. What has this displayed?
Note that the files have a series of information concerning them as shown below.
drwx------ 2 cm34
staff 512 Jun 22 1999
Mail/
-rw------- 1 cm34
staff 3092 Nov 6 1999
arp.txt
-rw------- 1 cm34
staff 4530 Aug 28 1999
ping_man.txt
drwxr-xr-x 11 cm34
staff 1536 Oct 4 00:05
public_html/
16. The first few characters (or spaces) relate to the attributes for the file. Note that both Mail and public_html have the letter d at the start of the line and also a trailing /. This indicates that they are directories. When were these directories created?
Now observe the next 9 characters (or spaces) e.g. rwxr-xr-x . These are permissions assigned to that file or directory.
r indicates that the file has read permission
switched on
w indicates that the file has write permission switched
on
x indicates that the file has executable permission
switched on
The letters are grouped in threes.
The first rwx is the permissions assigned to
yourself.
The second rwx is the permissions assigned to a user
defined group.
The third rwx is the permissions assigned to everybody
else.
Therefore if I have a file that I want to be able to read and write and allow all others to read and write to it, the permissions will be:
rw-rw-rw-
Similarly, if I had another file that I wanted to allow all others except myself to be able to read and write (unlikely but possible) I would assign the permissions as:
---rw-rw-
17. What permissions do your file screen2.bmp have? What does this allow you, a group and others to do?
You can change these facilities by using the chmod command.
chmod:- chmod stands for change mode of the file. It allows you to alter the permissions that you give for yourself and others for accessing a file or directory.
At the UNIX prompt, you will see these permissions displayed for each file when you type ls -l e.g.
-rwxr--r--
The first letter specifies a directory or not, the remaining are three groups of three letters stating
the read, write and execute permissions for the owner, the group and everybody else.
Changing file access permissions using the chmod command:
Read = 4
Write = 2
Execute = 1
Suppose you wanted full access to a file called file.txt, but all others may only have read access to that file, i.e. nobody but yourself may change or execute a file. The process is described below.
Example 1
The chmod command takes 3 parameters to describe the type of file access followed by the filename that you wish to alter.
The first number refers to the permissions you give yourself.
The second number applies to permissions for a specified group.
The third number applies permissions for everyone else.
chmod
754 file.txt
The example above gives you read, write and execute permissions for a file called file.txt.
The group gets read and execute permission for the file called file.txt.
Everyone else only gets read permission for the file called file.txt.
Example 2
You wish to give yourself full access to a file called foo.exe. Everybody else (including group) is only allowed read access to your file.
To give yourself read, write and execute access, you add 4 + 2 + 1 = 7 and assign yourself a value of 7. The group and everyone else, read access only i.e. a value of 4.
The syntax of the command is:
chmod 744 foo.exe
You must provide three numbers, the first is the permissions for the owner, second for the group and third for everyone.
Example 3
To give yourself and the group read and write access, but none to anyone else:
chmod 660 [filename]
18. Rename your screen2.bmp file to screen3.bmp by typing:
mv screen2.bmp screen3.bmp
19. Change the permission of your screen3.bmp file so that you do not have read access to this file. What do you have to type as the extension to the chmod command? Check that the new name has the correct attributes. Log out of the TELNET window by typing:
logout
20. Use ftp to log back into newzeus. Obtain a directory listing using ls. Can you see screen3.bmp?
Now try to download screen3.bmp with FTP using the get command. What happens?
21. Make a note of the message that you received back from newzeus. What use can you think of for the chmod command?
IMPORTANT The work that you complete in the laboratory must be shown to your assessor during the laboratory period. You must show your work in order to get a mark for the laboratory.
Selecting Text from the Command Line
When using the MSDOS prompt, selected text may be copied using the right mouse button while the cursor is over the toolbar of the MSDOS prompt. By using Edit, Mark, you can select text to paste to the clipboard by dragging the white highlighted area over the text you require. Clicking the right button or pressing Enter will allow you to copy the selected text to the clipboard. you may now paste this text into the application of your choice.
ALTERNATIVELY
To save the output of a windowed program to the
clipboard, firstly highlight the window you wish to have a copy of,
then hold down
AltGr and Print Screen buttons. This places the application's screen
output
on the clipboard. By opening a graphics package you can paste the image
into the package e.g. pbrush.exe.
Note that this will
produce a larger file than saving the text as text only.
Creating a certain sized file in Paint
Open pbrush.exe from Start, Run then choose Image, Attributes from the Paint menubar. Select Pels (pixels) as the Units and specify the width and height in the fields within the Attribute window. Click OK then save the file as 24-bit colour.
A pixel is the name given to a picture element in a bitmap. An array of pixels is displayed on the screen in the bitmap as the picture. You have the ability to colour each of the pixels according to your picture. Each pixel may take on several different colours, according to the colour preference that you specify. In this example, each pixel may be described using 24 bits. This gives 2 raised to the power of 24 ( 224 ) different shades for each pixel.
Written by MM Clements
Last updated :
19/10/201013:21