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
- Open a
socket and wait for a connection
- For
each connection
- Fork
when the connection occurs
- Read
the username and encrypted password from the socket.
- Check
the encrypted password from the password file /home/username/.remote_passwd
- If
the file doesn’t exists, is not readable, or does not match, then send
back an error and exit.
- Dup stdin, stdout, and stderr onto the socket
- Exec
the command
The client should
- Read
the password and username from the environment.
- Encrypt
the password.
- Open a
socket to the remote host.
- Send
the username, encrypted password, and command to the remote host.
- Wait
for input from either the keyboard or socket, and display it on the other
side.
- Exit
when the socket or keyboard closes.
This assignment is worth 13 points.