Ch 5 Connecting to Red Hat Enterprise Linux 9 Flashcards

(65 cards)

1
Q

What is the difference between a console and a terminal?

A

console: the environment a user is looking at – what you see when you looking at your screen

terminal: an environment opened ON the console, and provides access to a nongraphical shell – usually Bash. Terminal, aka the shell, aka the Command Line Interface, aka the CLI

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where are a console and terminal the same thing, and where are they not?

A

in a text environment only environment, they are the same

in a graphical environment, they are not. console is screen and terminal is the shell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

you can have multiple terminals on a console, but you cannot have multiple consoles in one terminal

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what are two ways to connect to a server?

A

remotely, or the local console login (localhost login)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What must you remember during linux installation in order to have more than just the root user offered at the localhost login?

A

give the root user a password, create a regular user…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

why is it better to login as a regular user and not the root user? list 6

A
  1. makes it harder to make serious mistakes
  2. you often don’t need root permissions
  3. attackers not only have to guess the root password, but the guest username as well
  4. if you need root access, use sudo -i to open a root shell, using your current user’s password – this is more secure than su -, because you don’t type in the root password. any only some users are authorized to do this
  5. type su - to open a root shell,but you have to enter the root user password. you will work as root until you type exit
  6. use sudo for only specific admin tasks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

why don’t subsequent terminals not need a password to be entered?

A

because all subsequent terminals are opened as subshells – and you have access to the same user account that the parent shell is logged in as

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how can you open a subshell with a different user identity?

A

su - [name of user, or blank for root user]

or sudo -i to open a root shell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is the utility of being able to open a subshell as another user?

A

to test and preview things under a different user?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

how do you toggle between terminals in a non graphical environment?

A

do not use these in a graphical env!!

Alt + F1 – move to GDM graphical login (GNOME display manager)

Alt + F2 – provide access to curent graphical console

Alt + F3 – give access back to the current graphical console

Alt + F4 - F6 – give access to nongraphical consoles

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

how many terminals can you have open at a time?

A

six virtual terminals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

an alternative to Alt-Fx to toggle terminals is what command?

A

chvt (change virtual terminal)

chvt 1 - goes to graphical login prompt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

which virtual console is the default console, and what is it also called?

A

the first one, virtual console tty1 - has a corresponding device file in the /dev directory called /dev/tty1

(there’s a /dev/tty1 through /dev/tty6)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

how must the terminal toggling keyboard shortcuts be altered in a graphical environment?

A

instead of Alt + Fx, you use Ctrl+ Alt + Fx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

to go back from text environment back to GUI, do you need to add Ctrl to the Alt + Fx terminal toggle?

A

no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What systemwide configuration allows you to use X forwarding?

A

/etc/ssh/ssh_config

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

what type of file is associated with every linux environment terminal?

A

a device file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

where are the files for pseudoterminals (terminals started in a graphical environment) located vs the files for virtual terminals?

A

/dev/pts1, /dev/pts2, /dev/pts3, etc…

vs

/dev/tty1, /dev/tty2, /dev/tty3, etc…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

what is a useful tool during the exam to see that you have configured things properly?

A

reboot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

the more often you reboot, the easier it will be to pinpoint what change led to the boot failure

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

what are 3 situations where a reboot is required?

A
  1. to recover from a serious problem the server hanging, kernel panics
  2. to apply kernel updates
  3. to apply changes to kernel modules that are being used currently and therefore cannot be reloaded easily
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

what are the drawbacks of simply cutting power to a server vs a planned reboot or shutdown?

A

processes have not yet written their data to the disk – it’s stored in a cache

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

how do you execute a proper reboot?

A

need to reboot in a way that involves systemd so it can orchestrate the proper shutdown of the other services

systemctl reboot or reboot
systemctl halt or halt
systemctl poweroff or poweroff

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

what’s the first process to start when a server boots?

A

systemd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
what's special about the systemd process?
it manages all the other processes
26
what is the difference bw systemctl halt and systemctl poweroff?
poweroff talks to the power mgmt on the machine to power it off, and halt only shuts down the box, not turn off power
27
if poweroff, halt, and reboot don't work remotely to turn off power, what other option do you have? (like if the system is really fubar)
echo b > /proc/sysrq-trigger (as root user)
28
what does echo b > /proc/sysrq-trigger do?
immediately resets the machine without saving anything....is a last resort!!
29
if ssh has not been configured on port 22, what do you need to remember when using the ssh command?
you need to add the -p flag to specify the port if not configured for port 22 ssh -p 5543
30
what other OS can a linux OS ssh to (natively)?
mac
31
how can you ssh to a linux server from Windows?
if on a windows version with no subsystem for linux... use an ssh client like... PuTTY MobaXterm KiTTY mRemoteNG secureCRT Bitvise Xshell
32
what's the basic format of an ssh command?
user@server
33
what is stored in the ~/.ssh/known_hosts file?
the public key fingerprint
34
how does ssh utilize the known_hosts file?
it checks that the fingerprint there works with the encryption key sent back by the server you're trying to connect with
35
You are trying to connect to another server and there is a mismatch between the encryption key sent back by the server and the public key fingerprint that you have stored for that server. What are possible reasons for this?
1. Could be connecting to the wrong server 2. Could be an interceptor/attack? 3. New OS installation at that same IP, or different box using that IP now 4. First time connecting to a new server 5. The sshd service on that server was re-installed/new key was created
36
what should you do if there's a mismatch between the server you're trying to ssh to and the public key fingerprint stored for it?
remove the existing public key fingerprint that you have for that host in the ~/.ssh/known_hosts file
37
how can you remove a host entry from ~/.ssh/known_hosts file with sed?
sed -i -e '25d' ~/.ssh/known_hosts this removes line 25 (-i means edit in place, or write permanent changes to the file, and -e means some kind of scripting will follow)
38
why doesn't an ssh connection become graphical by default?
it's a security risk...you could see things you shouldn't
39
what are the two requirements in order to create a graphical connection to another server with ssh?
1. an x server has to run on the client computer (my computer) 2. the destination computer, or the remote host, must be allowed to display screens on my client computer
40
how do you make a graphical ssh connection while also providing permission for the remote server to send its graphical data back?
ssh -Y ssh -Y linda@server2
41
what is the ssh -v flag
verbose output
42
what is the ssh -Y flag
enables support for graphical apps
43
44
what is X forwarding?
starting graphical applications through an SSH session
45
How do you enable X forwarding when you ssh?
Add the line: ForwardX11 yes to the /etc/ssh/ssh_config file (and this will make x forwarding happen by default)
46
what are two secure transfer protocols/commands?
scp and sftp (add rsync if you want to synchronize the file)
47
how would you copy a file from another server to your home server?
scp root@server2:/etc/passwd ~ (copy /etc/passwd from server 2 and copy it to the ~ home directory of server 1)
48
how do you securely copy a directory to a remote server?
scp -r server2L/etc/ .tmp (copy the entire etc directory on server2 to the tmp directory of server1)
49
How do you scp through a non-default port?
scp -P is -p for ssh, but -P for scp
50
How does the sftp command work?
you open an FTP client session to the remote server, and the only requirement on the remote server is that it runs an sshd process use typical FTP commands like "put" (upload) and "get" (download)
51
when using sftp, what do you need to remember about downloading from the remote server?
it will always be downloaded to the local directory (and the same for uploading...comes from the local directory)
52
what does rsync do?
synchronizes files between remote and local directory when copying -- this is a good choice when you only want to copy over differences between a file or directory. so if you frequently transfer a file, it will only transfer the latest change
53
what does this do? rsync -r
synchronize the entire directory tree (recursive)
54
what does this do? rsync -l
copy over symbolic links as symbolic links
55
what does this do? rsync -p
preserve permissions when copying
56
what does this do? rsync -n
only do a dry run, don't synchronize anything
57
what does this do? rsync -a
copy over using archive mode, thus ensuring the entire subdirectory trees and all file properties will be sncrhonized
58
what does this do? rsync -A
use archive mode and ALSO synchronize ACLs
59
what does this do? rsync -X
syncrhonize SELinux context as well
60
what is ssh login, as opposed to password login?
it's key-based login
61
what are prereqs to using ssh?
generating a key pair
62
Creating a key for ssh involves using ssh-keygen. Where is the public key stored?
~/.ssh/authorized_keys (in the home directory of the target user...not your current server, your remote one)
63
what command generates a public-private keypair for ssh?
ssh-keygen
64
what command copies the ssh public key from ssh-keygen to the remote host
ssh-copy-id
65