3. Connecting to a Server

Learn about sudo/su/sudo -i here and the concepts:

  • su - it logs into the root account if you have the root's password

  • sudo -i it also does the same but once you are in the wheel group, you need to type in your password rather than the root's password which is a safer way.

  • sudo visudo contains the configuration file for the sudo management.

  • /etc/sudoers.d/ contains some snap in files that lets you add these configurations as snap-ins.

Graphical Interface to Command-line Interface:

By default, there are 6 virtual terminals that is like a computer with 6 screens and keywords attached to it.

  • These virtual terminals are also known as tty.

  • chvt 1 is the only terminal that's graphical.

  • chvt 2is a non-graphical terminal. You can have 4 other virtual terminals.

Checking which tty (terminal) you have logged into, who am i:

SSH Concept

When you request for a SSH connection from a remote server, the server answers with a key that is used for two purposes.

  1. Used for encryption

  2. Used to prove the identity of the server

Imagine an attacker has broken into your DNS system (DNS hijacking). And, rather than sending your traffic to the legitimate server, it is redirecting you to a malicious server. So, when attempting to connect to that fake server, the malicious server (like any other server) would send you the key that you can compare with the one you have been provided to connect with the legitimate server. This way you can be sure to be connected to the correct server.

SCP is part of SSH bundle. It makes it easier to copy files over one server to another.

scp target_file username@