Move files between Linux systems by using command-line utilities.
Outcomes
Access a remote computer by using the SSH protocol.
Copy a file to a remote computer.
As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.
[student@workstation ~]$ lab start network-remote
Instructions
On the servera machine, enable remote login over SSH.
Use student as the user and student as the password to log in.
Use the student user sudo privileges to run the systemctl command.
Log in to the servera machine.
[student@workstation ~]$ssh student@serverastudent@servera's password:student...output omitted... [student@servera ~]$
Enable the SSH service.
Use the systemctl command with sudo privileges to enable the service.
[student@servera ~]$sudo systemctl enable --now sshd[sudo] password for student:student
Verify that the SSH service is active.
[student@servera ~]$sudo systemctl status sshd● sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)Active: active (running)since Mon 2023-11-20 14:05:18 EST; 3h 23min ago ...output omitted...
Review the system information and IP addresses for the servera machine.
Review the fully qualified domain name (FQDN) and operating system version of the servera machine.
[student@servera ~]$ hostnamectl
Static hostname: servera.lab.example.com
...output omitted...
Operating System: Red Hat Enterprise Linux 9.1 (Plow)
...output omitted...
Hardware Vendor: Red Hat
Hardware Model: OpenStack ComputeReview the IP addresses of the servera machine.
[student@servera ~]$ip addr show1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:00:fa:0a brd ff:ff:ff:ff:ff:ff altname enp0s3 altname ens3 inet172.25.250.10/24brd 172.25.250.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe00:fa0a/64 scope link valid_lft forever preferred_lft forever
Exit the servera machine.
[student@servera ~]$ exit
logout
Connection to servera closed.
[student@workstation ~]$On the workstation machine, redirect the output of the hostname command to create the machine-name.txt file.
Save the output of the hostname command to the machine-name.txt file.
[student@workstation ~]$ hostname > machine-name.txtVerify the content of the machine-name.txt file.
[student@workstation ~]$ cat machine-name.txt
workstation.lab.example.comCopy the machine-name.txt file to the servera machine by using the scp command.
Enter student as the password for the servera machine when prompted.
[student@workstation ~]$scp machine-name.txt student@servera:~student@servera's password:studentmachine-name.txt
Log in to the servera machine and confirm that the machine-name.txt file is successfully copied.
[student@workstation ~]$ssh student@serverastudent@servera's password:student...output omitted... [student@servera ~]$cat machine-name.txtworkstation.lab.example.com
Exit the servera machine.
[student@servera ~]$ exit
logout
Connection to servera closed.
[student@workstation ~]$