mdinfotech.net  

Exercise: SSH, SFTP, and Linux

Preliminary Skills  |  Exercise 1  |  Exercise 2  |  Exercise 3

After this exercise you will be able to:

  1. connect a UNIX Server using SSH.
  2. use basic Linux commands.
  3. upload/download files using SFTP.

Preliminary Skills

A) Open a SSH Client

  1. If you are at school, find WinSCP.

  2. If you are at home: Download and install Putty and Win SCP

B) To connect the Linux Server using SSH:

  1. In WinSCP select the protocol SFTP.

  2. Use the following information:
    FROM HOME - Host Name: 142.31.53.141
    FROM SCHOOL NETWORK - Host Name: 10.49.31.251
    User Name: your first name all lower case
    Use the password you set up with Ms. Wear.
    
    Click Login.

  3. This will open the File Transfer Window.


Exercise 1: Using Linux

  1. Click the menu Commands > Open in PuTTY

  2. Type in your password again

  3. In the listing of your directories, you should have seen a folder called public_html. This is the file that contains website files. Type cd public_html to go into this directory.

  4. Type pwd again. Your current directory should now be public_html.

  5. Learn more linux commands from this Linux Tutorial on Files and Directories. Ensure you understand all of the commands at the bottom of the tutorial.

  6. Using one of the new commands you learned in the above tutorial, make a directory in public_html titled helloworld.

  7. Now go into your new folder. Double check that you are in the correct folder. You will use this folder in the next part of the assignment. To get back to the public_html directory, type cd ...

  8. To disconnect from the Linux Server, type exit. Close the SSH client.


Exercise 2: Using Secure File Transfer (SFTP)

After this exercise you will be able to:

  1. upload and download files.
  2. delete files.
  3. add a new folder.

What to do:

This exercise requires you to download and uploads files from/to a remote system using SFTP.

  1. Connect to the Linux server through WinSCP.

  2. Set the Transfer Settings to Text.

  3. Upload an image to the public_html/helloworld directory.

  4. View the image by going to a browser and typing in:
    	  FROM HOME: http://142.31.53.141/~yourname/helloworld/imagename.jpg
    	  OR FROM SCHOOL:  http://10.49.31.251/~yourname/helloworld/imagename.jpg
    	  
    Note: Is the image not working? Why or why not? Think: you uploaded an image using text format.

  5. Now set the Transfer Settings to Binary.

  6. Upload an image to the public_html/helloworld directory.

  7. And view the image by going to a browser and typing in:
    	  FROM HOME: http://142.31.53.141/~yourname/helloworld/imagename.jpg
    	  OR FROM SCHOOL:  http://10.49.31.251/~yourname/helloworld/imagename.jpg
    	  
    Note: Is the image not working? Why or why not? Think: you uploaded an image using binary format.

  8. Change the Transfer Settings to Default.

  9. Upload any html file (and css) to public_html/helloworld

  10. Rename the html file index.html

  11. Using a browser, go the the URL
    	  FROM HOME: http://142.31.53.141/~yourname/helloworld/
    	  OR FROM SCHOOL: http://10.49.31.251/~yourname/helloworld/
    	  
    	  
    You should see your webpage.


Exercise 3: File Permissions

After this exercise you will be able to:

  1. understand linux permissions
  2. set secure permissions on files and directories

What to do:

  1. Through the WinScP client, right click on index.html stored on the Linux server and select "Properties". You should see nine checkboxes labelled permissions.
    permissions

  2. Uncheck all of the boxes.
    Question
    a) What happens to the number underneath the check boxes?
    b) Can you still see index.html through the browser?
    c) Can you view the file contents using the command line?
    d) Can you save a new version of index.html on top of it?
  3. Determine which permissions boxes must be selected to allow index.html to be viewed through the browser.
    Question
    Determine a relationship between the number below the checkboxes and the boxes that are checked.
  4. Read Linux Permissions and see if you are correct.