Notes:  There are notes about the std string library at http://www.msoe.edu/eecs/cese/resources/stl/string.htm.

 

Your mission is to create a remote shell.  The remote command should read the user’s name and password from the environment.  It should read the hostname and command to run from the command line.  It should use a port number compiled into the code.  Below is how the syntax should look.

 

bash$ USER=randy

bash$ PASSWD=fred

bash$ remote euclid ls

file1

file2

file3

bash$ remote euclid cp file1 file4

bash$ remote euclid ls

 

The remote server should

  1. Open a socket and wait for a connection
  2. For each connection
    1. Fork when the connection occurs
    2. Read the username and encrypted password from the socket.
    3. Check the encrypted password from the password file /home/username/.remote_passwd
    4. If the file doesn’t exists, is not readable, or does not match, then send back an error and exit.
    5. Dup stdin, stdout, and stderr onto the socket
    6. Exec the command

 

The client should

  1. Read the password and username from the environment.
  2. Encrypt the password.
  3. Open a socket to the remote host.
  4. Send the username, encrypted password, and command to the remote host.
  5. Wait for input from either the keyboard or socket, and display it on the other side.
  6. Exit when the socket or keyboard closes.

 

This assignment is worth 13 points.