13,420
edits
Changes
→INVESTIGATION 2: USING SECURE FILE TRANSMISSION CONTROL PROTOCOL
:In the next investigation, you will use the '''sftp''' Linux command to transfer (i.e. copy) files between servers.<br><br>
=INVESTIGATION 2: USING SECURE FILE TRANSMISSION CONTROL PROTOCOL FTP =
In this section, you will learn how to use the '''sftp''' command to transfer files between Unix/Linux servers and perform some basic directory navigation/management operations.
<span style="color:blue;">'''NOTE:''' Since the only server account you have is your '''Matrix''' server, we will simulate using the '''sftp ''' command to transfer/copy from your '''Matrix''' server to '''<u>another instance</u> of your Matrix server'''. You are NOT required to edit your ''.bashrc'' file to make this work since you already performed that operation in the previous investigation.</span>
# Use a text editor to create a text file called '''thefile.txt'''<br><br>
# Enter the following two lines displayed below for this text file:<br><span style="font-family:courier;font-weight:bold;">This is my file called thefile.txt<br>It is also a small file</span><br><br>
# '''Save''' editing changes to the text files file and exit your text editor.<br><br>
# Change back to your '''home''' directory and confirm that you are located in your ''home'' directory.<br><br>Let's run a '''shell script''' to check to make certain that you created the correct directories<br>and that you created the '''myfile.txt''' file (with correct file contents) in the '''~/local''' directory<br>before learning to use the ''sftp'' Linux command.<br><br>
# Issue the following Linux command to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts/week6-check-3</span><br><br>
# Issue the following ''sftp command'' to create a directory on your remote server: <span style="color:blue;font-weight:bold;font-family:courier;">mkdir remote</span><br><br>
# Issue the following ''sftp command'' to confirm that the '''remote''' directory has been created in your remote server's home directory:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls</span><br><br>
# Issue the following ''sftp command'' to change to the '''remote''' directory on your ''remote '' server:<br><span style="color:blue;font-weight:bold;font-family:courier;">cd remote</span><br><br>
# Issue the '''pwd''' ''sftp command'' to confirm that you have changed to the ''remote2'' directory on your remote server.<br><br>
# Issue the following sftp command to change to the '''local''' directory on your local server:<br><span style="color:blue;font-weight:bold;font-family:courier;">lcd local</span><br><br>
# Issue the following ''sftp command'' to create the following directory on your local server:<br><span style="color:blue;font-weight:bold;font-family:courier;">!mkdir local2</span><br><br>
# Issue the following ''sftp command'' to change to the '''local2''' directory on your local server:<br><span style="color:blue;font-weight:bold;font-family:courier;">lcd local2</span><br><br>
# Issue the '''!pwd''' ''sftp command'' to confirm you have changed to the ''local2'' directory on your local server.<br><br>Let's learn to <u>download </u> a file from your remote server to your local server.<br><br>
# Issue the following '''sftp command''' to transfer your '''thefile.txt''' file from your remote directory on your local server:<br><span style="color:blue;font-weight:bold;font-family:courier;">get thefile.txt</span><br><br>
# Issue the '''!ls''' '''sftp command''' to confirm that you transferred/copied the file: thefile.txt on your local server.<br><br>