Chapter 5 - Connecting to Redhat Enterprise Linux Flashcards
What is a terminal?
A terminal is an environment that is opened on the console and provides access to a text shell, which is the command-line environment that can be used to type commands.
What is a console?
a console as the environment the user is looking at. That means that the console is basically what you see when you are looking at your computer screen.
What is the difference between a console and terminal?
In a textual environment, the words console and terminal are more or less equivalent. In a graphical environment, they are not. Think of it like this: You can
have multiple terminals open on a console, but you cannot have multiple consoles open in one terminal
How to work with multiple terminals in a graphical environment?
As an administrator, youcan open several terminal windows, and in each terminal window you can use the su - command to open a shell in which you can work with a different user identity.
This allows you to easily test features and see the results of these tests immediately
How to work with multiple terminals in a non-graphical environment?
In a nongraphical environment, you only have one
terminal interface that is available and that makes working in different user shell environments a bit more difficult. For this purpose we use virtual terminals. This feature allows you to open six different terminal windows from the same console at the same time and use
key sequences to navigate between them. To open these terminal windows, you can use the key sequences Alt-F1 through Alt-F6
What is a virtual terminal in linux?
To offer an option that makes working from several consoles on the same server possible, Linux uses the concept of a virtual terminal. This feature allows you to open six different terminal windows from the same console at the same time and use key sequences to navigate between them
What is the different virtual consoles available in linux?
To open/switch between virtual terminal windows, you can use the key sequences Alt-F1 through Alt-F6
F1: Gives access to the GNOME Display Manager (GDM) graphical login
F2: Provides access to the current graphical console
F3: Gives access back to the current graphical session
F4–F6: Gives access to nongraphical consoles
What is the command command enables you to switch to a different virtual environment directly from the current environment?
chvt command
Where are the corresponding device files for the virtual consoles?
virtual consoles corresponding device file in the
/dev directory. virtual consoles have
corresponding device files, which are numbered “/dev/tty1” through “/dev/tty6”
When switching between the virtual consoles, what is the difference between Alt-F6 and Ctrl-Alt-F6 key sequences
Alt-F6 and Ctrl-Alt-F6 key sequences are essentially the same. It is important to use the Ctrl key as well when going from a GUI to a text environment. To go back from the text environment to the GUI environment, using the Ctrl key is optional.
Where are the corresponding device files for terminal windows opened in a graphical environment?
For terminal windows that are started from a graphical environment, pseudo terminals are started. These pseudo terminals are referred to using numbers in the
“/dev/pts” directory. So, the first terminal window that is started from a graphical environment appears as /dev/pts/1, the second terminal windows appears as
/dev/pts/2, and so on.
What are some serious scenarios when linux system has to be rebooted?
- To recover from serious problems such as server hangs and kernel panics
- To apply kernel updates
- To apply changes to kernel modules that are being used currently and therefore cannot be reloaded easily
Why do you lose data when a linux server is just stopped by pulling the power plug?
That is because processes that have written data do not typically write that data directly to disk, but instead store it in memory buffers (cache) from where it is committed to disk when it is convenient for the operating system. When a server is rebooted, all processes that are running need to shut down properly. But this does not happen when you pull off the power plug
What happens when you issue a proper reboot of a Linux system?
To issue a proper reboot, the systemd process has to be alerted. The systemd process is the first process that was started when the server was started, and it is responsible for managing all other processes, directly or indirectly. As a result, on system reboots or halts, the systemd process needs to make sure that all these processes are stopped
What are the commands to perform a proper reboot or a proper shutdown?
systemctl reboot or reboot
systemctl halt or halt
systemctl poweroff or poweroff
What is the difference between halt and poweroff command?
The difference between these two commands is thatthe systemctl poweroff command talks to power management on the machine to shut off power on the machine. This often does not happen when using systemctl halt
Which command to use to force a linux machine to reset?
echo b > /proc/sysrq-trigger
This command immediately resets the machine
without saving anything. Notice that this command should be used only if there are no other options!
What is Secure Shell or SSH?
Secure Shell is the common method to gain access
to other machines over the network
What service and what port has to be running for SSH to work?
sshd service must be running and offering services at
port 22, and it should not be blocked by the firewall. The ssh command by default tries to reach the sshd process on the server port 22
Which option to use to specify the port with SSH command?
“ssh -p” followed by the port number you want to connect to
What is the command if you want to establish
an SSH session as user root to a remote server
ssh root@remoteserver
or
ssh remoteserver -l root
[root@server1 ~]# ssh 192.168.4.220 -l root
The authenticity of host ‘192.168.4.220 ()’ can’t be established.
ECDSA key fingerprint is 35:64:36:f8:ac:4f:8a:94:aa:6e:4b:85:ed:76:0a:eb.
Are you sure you want to continue connecting (yes/no)?
^ What is the above warning/error message you are seeing?
The security message is displayed because the remote server has never been contacted before and therefore there is no way to verify the identity of
the remote server. After connecting to the remote server, a public key fingerprint is stored in the file “~/.ssh/known_hosts”
which option to use with SSH command to enable support for graphical applications?
-Y option. Example : ssh -Y linda@server2
Which is the secure way of transferring files between two linux systems?
scp command. The scp command is similar to the cp command, which is used to copy local files,
Which command. tobe used to synchorinize files between two linux systems?
rsync command
How to specify the port with the SCP command?
scp -P
Which is the other command besides scp or cp which can be used to securely transfer files?
sftp
How does SFTP file transfering work?
When working with sftp, you open an FTP client session to the remote server, where the only requirement on the remote server is that it should be running the sshd process. From the FTP client session, you use typical FTP client options, like put to upload a file or get to download a file.
Which command uses SSH to synchronize files between a remote directory and a local directory
rsync
Which command to use to generate a key pair?
ssh-keygen
Which command is used to copy the public key over to the remote server?
ssh-copy-id
Example : ssh-copy-id server2 - to copy to server2 the public key you have just created