SSH and Secure Copy

Learn how to connect and copying files in a secure way to another server remotely.

SSH :

SSH or Secure shell, is a known protocol used for connecting to server remotely, in RHCSAv8 you just have to learn how to connect from server to server. below you will find the command syntax :

  • systemctl enable --now sshd -> to enable the sshd service.

  • ssh <user_name>@<ipaddress/host_name>

  • vim /etc/ssh/sshd_config -> configuration file for ssh.

Host key is stored in ~/.ssh/known_hosts

Sensitive data will be sent through an encrypted connection.

SCP :

SCP (secure copy) is a command-line utility that allows you to securely copy files and directories between two locations. Below you will find the right command to do that :

  • scp <file_name> username@<ip_adress>:/remote/directory

chvt :

chvt - change foreground virtual terminal, The command chvt N makes /dev/ttyN the foreground terminal.

  • chvt 4 -> change the virtual terminal to tty4.

or you can change the virtual terminal directly through your keyboard by clicking on

ctrl + alt + F(1-2-3-4-5-6)

su :

su - switch user, another powerful command used to switch from user to user.

  • su - chxmxii -> to switch from the current user to chxmxii

  • su - -> to switch from the current user to the root user.

the "-" will take you to the home directory of the user. you are free to use it or not.

sudo :

sudo - super user do, use this command to execute tasks with root power.

  • sudo userdel user1 -> normal user cannot run this command without using sudo as only root can add and delete users.

to allow users running commands as root you need either to :

  • vim /etc/sudoers or visudo and add the user <username> under #allow root to run any commands anywhere

  • -> I allowed user chxmxii to run any commands anywhere.

  • usermod -aG wheel <username> -> adding the user to the wheel group is alot easier. don't forget to uncomment this line.

Last updated

Was this helpful?