Linux Lab #4

Due Wednesday, June 8

Use the script command to make a log of your activities. The log should be named Lab4.HOSTNAME.DATE where HOSTNAME is your hostname (fetched from an environment variable or inline execution) and DATE is the current date and time in the format MMDDYY (fetched with inline execution). (E.g. "Lab4.LINFORD3040.052305")

In answering direct questions below (as marked by the question-mark '?'), use a shell comment to give your answer. For example, if I say: "What is the command to give you the system time?" You should type, at the command prompt, "# date is the command" or something to that effect. The important part is the hash-mark '#' which causes the shell to ignore everything behind it.

I strongly recommend that you use two terminals: one to run the script command and one to test your commands before executing them under script. It's also a good idea to use shell comments to say which part of the assignment the following commands are for.

SSH Key Authentication

  1. Create a user with username cs3040
  2. Change users to cs3040
  3. Use ssh-keygen to generate a DSA ssh authorization key
  4. Use SCP to copy the public key to 192.168.0.100:/home/cs3040 as "id.pub.HOSTNAME" where HOSTNAME is your hostname. BE VERY CAREFUL TO CHANGE THE FILE NAME!
  5. Log into 192.168.0.100 as cs3040
  6. Append the contents of the public key file to ~/.ssh/authorized_keys. BE VERY CAREFUL TO APPEND, NOT OVERWRITE! The command you want is "cat id.pub.HOSTNAME >> ~/.ssh/authorized_keys
  7. Log out of 192.168.0.100
  8. Make sure you are still cs3040 and ssh 192.168.0.100. Were you prompted for a password?

When finished, type exit or press ^D until you get a message like "Script done, file is Lab4.HOSTNAME.DATE". To turn in the assignment, scp the logfile to 192.168.0.100:/public_3040 as user "cs3040"