nita 212 - open source platform & network administration - lab #9

2
Lab #9 - Backups, Remote Commands, and F ile T ransfer St ani sla v Lab Steps: I. 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 le s you have in your home directo ry into the new ly create d direct ory . D. Type the command tar cfj mybackup.tar.bz2 mybackup to create the compressed archive. E. List the contents of yo ur dir ector y now and see that mybackup.tar.bz2 now exists. F. Car ef ul ly 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 II . Re st or ing a Compr essed tar Backup A. Ve rify th at you a re stil l in your home director y with t he mybackup.tar.bz2 le. B. Type tar xfj mybackup.tar.bz2 to uncompress your backup archive. C. List y our ho me dir ector y again and you should see your mybackup directory with all of its les. III. Using sftp to Remotely Download Files D. Type the command sftp <remote username>@<remote ip> E. Agree to co ntinue co nnecti ng to the serve r (this wil l happen the rs t time for any ne w host). F. Typ e t he user s password which will be provided to you by your i nstructor . G. Y ou should now ha ve a pr omp t that is sftp> H. Type ls to view the remote system s les. 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 i n on the local computer you are connecting from. K. Type get <lename> to download a remote system s le. L. Type quit and you will now back to your local system. M. Open th e le you just do wnload ed and v iew the contents. IV. Using scp to Remotely Copy a File to your Machine A. Rename the le you downloaded from the server to <username>.<lename> -- e.g., if the le you  just downloaded is called myle and your username is bjones rename the le to bjones.myle B. Type scp <username>.<lename> <remote username>@<remote ip>:~/ C. Ente r th e user s password when prompted. D. Y ou should see th at the le was cop ied over to the remote host , into the remote user s home. E. Connect to t he serv er again using sftp to verify the le was uploaded successfully . F. Exit your sftp session. V. Using ssh to Have a R emote Syste m s Shell A. Type ssh <remote username>@<remote ip> and enter your password when prompted. B. Y ou are now conn ected with a remote sh ell just as if you woul d be if you were local to th e server. C. Use vim on the remote server to open the le you uploaded in the last task. D. Cl ose your ssh session by typing the exit command. VI. Using ftp to Remotely Download Files A. Type ftp <remote ip> and press Enter. B. Enter the r emote user s username when prompted and press Enter. C. Ent er the r emote us er s password when prompted and press Enter. D. Y ou s hould now have an ftp> prompt. E. Y ou c an ex ecute simila r co mmand s lik e yo ur sftp session (ls, get, quit). F. Type quit to leave your ftp session.

Upload: mstanislav

Post on 06-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NITA 212 - Open Source Platform & Network Administration - Lab #9

 

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

Lab Steps:I. 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 mybackupG. Verify that your mybackup directory is gone and that you still have mybackup.tar.bz2

II. Restoring a Compressed tar BackupA. 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.

III. 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.

IV. 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.

V. 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.

VI. Using ftp to Remotely Download FilesA. 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.

Page 2: NITA 212 - Open Source Platform & Network Administration - Lab #9