13,420
edits
Changes
→INVESTIGATION 1: USING SECURE COPY
<li>Issue the following Linux command to copy the <b>mytextfile.txt</b> file from your local machine to your remote Matrix server<br>(replace yoursenecaid is <u>YOUR</u> Seneca ID and DO <u>NOT</u> INCLUDE THE : at the end of the command so see what happens):<br><span style="color:blue;font-weight:bold;font-family:courier;">scp mytextfile.txt yoursenecaid@matrix.senecacollege.ca</span><br><br>Did you notice anything different (i.e. no password)?<br><br></li><li>Issue the following command (using your matrix username):<br><span style="color:blue;font-weight:bold;font-family:courier;">ssh yoursenecaid@matrix.senecacollege.ca ls -l mytextfile.txt</span><br><br></li><li>When prompted, enter your password and press ENTER.<br><br><b>The file does NOT appear. That is because the COLON was NOT added to the end of the command!</b><br><b>Therefore, you MUST remember to include the COLON : at the end of the hostname, or it will NOT properly remotely copy the file!</b><br><br></li><li>Issue the following command to copy that same file to the ~/remote directory in Matrix:<br><span style="color:blue;font-weight:bold;font-family:courier;">scp other.txt yoursenecaid@matrix.senecacollege.ca:remote</span><br><br></li><li>Issue the following command to confirm that it was remotely copied to your '''~/remote''' directory in Matrix:<br><span style="color:blue;font-weight:bold;font-family:courier;">ssh yoursenecaid@matrix.senecacollege.ca ls -l /home/yoursenecaid/remote</span><br><br>Do you see the output for the detailed file listing of <b>output.txt</b>?<br>What does this indicate?<br><br><li>Issue the following command to copy the '''other.txt''' file to the ~/remote directory in Matrix renaming it is '''different.txt''':<br><span style="color:blue;font-weight:bold;font-family:courier;">scp other.txt yoursenecaid@matrix.senecacollege.ca:remote/different.txt</span><br><br></li><li>Issue the following command to confirm that the file was remotely copied to your '''~/remote''' directory in Matrix with a different filename:<br><span style="color:blue;font-weight:bold;font-family:courier;">ssh yoursenecaid@matrix.senecacollege.ca ls -l /home/yoursenecaid/remote/different.txt</span><br><br>What does this indicate?<br><br>Let's issue a checking script remotely to see that you properly copied that file from your<br>local computer to your remote Linux server to both your <b>home</b> directory and <b>~/remote</b> directory.<br><br></li><li>Issue the following:<br><span style="color:blue;font-weight:bold;font-family:courier;">ssh yoursenecaid@matrix.senecacollege.ca bash /home/murray.saul/scripts/week6-check-2</span><br><br>If you encounter errors, re-run the scp commands to correct and re-run the above command until you receive a congratulations message.<br><br></li><li>Remain in the terminal on your local computer for the ''INVESTIGATION 2''.<br><br></ol>
:In the next investigation, you will use the '''sftp''' Linux command to transfer (i.e. copy) files between servers.<br><br>