In this exercise, you will copy files from a remote system to a local directory using scp.
Outcomes
You should be able to copy files from a remote host to a directory on the local machine.
Log in as the student user on workstation using student as the password.
From workstation, run the lab archive-transfer start command.
The command runs a start script that determines whether hosts servera and serverb are reachable on the network.
The script also ensures that the file and directory to be created in the exercise does not exist on servera.
[student@workstation ~]$lab archive-transfer start
Use the ssh command to log in to servera as the student user.
[student@workstation ~]$ssh student@servera...output omitted...[student@servera ~]$
Use the scp command to copy the /etc/ssh directory from serverb to the /home/student/serverbackup directory on servera.
On servera, create a directory named /home/student/serverbackup.
[student@servera ~]$mkdir ~/serverbackup
Use the scp command to recursively copy the /etc/ssh directory from serverb to the /home/student/serverbackup directory on servera.
When prompted, enter redhat as the password.
Note that only the root user can read all the content in the /etc/ssh directory.
[student@servera ~]$scp -r root@serverb:/etc/ssh ~/serverbackupThe authenticity of host 'serverb (172.25.250.11)' can't be established. ECDSA key fingerprint is SHA256:qaS0PToLrqlCO2XGklA0iY7CaP7aPKimerDoaUkv720. Are you sure you want to continue connecting (yes/no)?yesWarning: Permanently added 'serverb,172.25.250.11' (ECDSA) to the list of known hosts. root@serverb's password:redhatmoduli 100% 550KB 57.9MB/s 00:00 ssh_config 100% 1727 1.4MB/s 00:00 05-redhat.conf 100% 690 1.6MB/s 00:00 01-training.conf 100% 36 80.5KB/s 00:00 ssh_host_ed25519_key 100% 387 1.2MB/s 00:00 ssh_host_ed25519_key.pub 100% 82 268.1KB/s 00:00 ssh_host_ecdsa_key 100% 492 1.5MB/s 00:00 ssh_host_ecdsa_key.pub 100% 162 538.7KB/s 00:00 ssh_host_rsa_key 100% 1799 4.9MB/s 00:00 ssh_host_rsa_key.pub 100% 382 1.2MB/s 00:00 sshd_config 100% 4469 9.5MB/s 00:00
Verify that the /etc/ssh directory from serverb is copied to the /home/student/serverbackup directory to servera.
[student@servera ~]$ls -lR ~/serverbackup/home/student/serverbackup: total 0 drwxr-xr-x. 3 student student 245 Feb 11 18:35 ssh /home/student/serverbackup/ssh: total 588 -rw-r--r--. 1 student student 563386 Feb 11 18:35 moduli -rw-r--r--. 1 student student 1727 Feb 11 18:35 ssh_config drwxr-xr-x. 2 student student 28 Feb 11 18:35 ssh_config.d -rw-------. 1 student student 4469 Feb 11 18:35 sshd_config -rw-r-----. 1 student student 492 Feb 11 18:35 ssh_host_ecdsa_key -rw-r--r--. 1 student student 162 Feb 11 18:35 ssh_host_ecdsa_key.pub -rw-r-----. 1 student student 387 Feb 11 18:35 ssh_host_ed25519_key -rw-r--r--. 1 student student 82 Feb 11 18:35 ssh_host_ed25519_key.pub -rw-r-----. 1 student student 1799 Feb 11 18:35 ssh_host_rsa_key -rw-r--r--. 1 student student 382 Feb 11 18:35 ssh_host_rsa_key.pub /home/student/serverbackup/ssh/ssh_config.d: total 8 -rw-r--r--. 1 student student 36 Feb 11 18:35 01-training.conf -rw-r--r--. 1 student student 690 Feb 11 18:35 05-redhat.conf
Exit from servera.
[student@servera ~]$exitlogout Connection to servera closed.[student@workstation]$
This concludes the guided exercise.