Lab #9 - Backups, Remote Commands, and File Transfer

Lab Steps:


Creating a tar Backup with bzip Compression A. Open Terminal and make sure you are not the root user. Type whoami and press Enter. B. Create a directory called mybackup. C. Copy a couple files you have in your home directory into the newly created directory. D. Type the command tar cfj mybackup.tar.bz2 mybackup to create the compressed archive. E. List the contents of your directory now and see that mybackup.tar.bz2 now exists. F. Carefully delete the mybackup directory by typing rm -rf mybackup G. Verify that your mybackup directory is gone and that you still have mybackup.tar.bz2 Restoring a Compressed tar Backup A. Verify that you are still in your home directory with the mybackup.tar.bz2 file. B. Type tar xfj mybackup.tar.bz2 to uncompress your backup archive. C. List your home directory again and you should see your mybackup directory with all of its files. Using sftp to Remotely Download Files D. Type the command sftp <remote username>@<remote ip> E. Agree to continue connecting to the server (this will happen the first time for any new host). F. Type the userʼs password which will be provided to you by your instructor. G. You should now have a prompt that is sftp> H. Type ls to view the remote systemʼs files. I. Type pwd to see the current directory you are in on the remote server. J. Type lpwd to see the current directory you are in on the local computer you are connecting from. K. Type get <filename> to download a remote systemʼs file. L. Type quit and you will now back to your local system. M. Open the file you just downloaded and view the contents. Using scp to Remotely Copy a File to your Machine A. Rename the file you downloaded from the server to <username>.<filename> -- e.g., if the file you just downloaded is called myfile and your username is bjones rename the file to bjones.myfile B. Type scp <username>.<filename> <remote username>@<remote ip>:~/ C. Enter the userʼs password when prompted. D. You should see that the file was copied over to the remote host, into the remote userʼs home. E. Connect to the server again using sftp to verify the file was uploaded successfully. F. Exit your sftp session. Using ssh to Have a Remote Systemʼs Shell A. Type ssh <remote username>@<remote ip> and enter your password when prompted. B. You are now connected with a remote shell just as if you would be if you were local to the server. C. Use vim on the remote server to open the file you uploaded in the last task. D. Close your ssh session by typing the exit command. Using ftp to Remotely Download Files A. Type ftp <remote ip> and press Enter. B. Enter the remote userʼs username when prompted and press Enter. C. Enter the remote userʼs password when prompted and press Enter. D. You should now have an ftp> prompt. E. You can execute similar commands like your sftp session (ls, get, quit). F. Type quit to leave your ftp session.