Questions Sysadmin

De Justine's wiki
Aller à la navigation Aller à la recherche

Questions

Les questions ci-dessous sont issues de cette page. Je vais me contenter pour l'instant des questions Junior / Sysadmin, essayer d'y répondre, et voir celles auxquelles je ne peux pas répondre.

Junior

Systeme

Give some examples of Linux distribution. What is your favorite distro and why?

Debian, Ubuntu, RHEL... I prefer Debian based distros since they're the most common, the ones i know best. Most commonly supported.

What are the differences between Unix, Linux, BSD, and GNU?

Unix is (was) a proprietary OS that inspired a slew of other OS, including GNU/Linux. Linux is a kernel. BSD is another UNIX OS. GNU is the OS that comes with Linux and is derived in distros.

What is a CLI? Tell me about your favorite CLI tools, tips, and hacks.

Command Line Interface. Ctrl + R to search, Ctrl + A / E, Using terminator, tmux, etc

What is your favorite shell and why?

Bash. Most common, i'll find the most resources on it. Is always preinstalled (no need to add anything else), redirections are fairly simple to understand

How do you get help on the command line? ***

Using man

Your first 5 commands on a *nix server after login.

date history systemctl w df -h

What do the fields in ls -al output mean?

perms, i don't know (number of links), propr. user, propr group, size in bytes, modtime, name

How do you get a list of logged-in users?

w

What is the advantage of executing the running processes in the background? How can you do that?

Using tmux / Ctrl + Z ? I can do something else in the meantime. But I prefer opening two shells anyway. WRONG Use &. For example : wget https://url-to-download.com/download.tar.gz &

Before you can manage processes, you must be able to identify them. Which tools will you use? ***

ps -ef. Maybe htop.

Running the command as root user. It is a good or bad practices?

Should be avoided if possible, since running as root can have consequences over the OS (depending on what we're doing).

How to check memory stats and CPU stats?

Memory with free, CPU with top

What is load average?

Defines CPU Usage. A loadavg of 1 represents one thread / core running 100%.

Where is my password stored on Linux/Unix?

/etc/shadow

How to recursively change permissions for all directories except files and for all files except directories?

find -type f -exec chmod 755 {} \; etc

Every command fails with command not found. How to trace the source of the error and resolve it?

echo $PATH and ADDON PATH=/bin:/sbin:/usr/bin:/usr/sbin; plus bash --login -x allows to debug

You typing CTRL + C but your script still running. How do you stop it? ***

Ctrl + D ? WRONG best thing is Ctrl + Z and then kill it)

What is grep command? How to match multiple strings in the same line?

General Regular Expression Something (Print ?). You can match multiple strings with a simple regex : cat x | grep -E "Alice|Bob"

Explain the file content commands along with the description.

cat : read / concatenate Head/Tail : read beginning / end less/more : Read page by page with added functionnality

SIGHUP, SIGINT, SIGKILL, and SIGTERM POSIX signals. Explain.

SIGHUP don't know SIGINT means there was an interruption, please reload SIGKILL means stop rn, SIGTERM means please terminate in a timely fashion (do your thing and stop). ADDON SIGHUP is sent when the terminal controlling the process is stopped. Can be catched and used for something.

What does kill command do?

Sends SIGKILL to a process

What is the difference between rm and rm -rf?

rm will delete files only. rm -rf will delete anything and force.

How do I grep recursively? Explain on several examples. ***

use grep inside a folder.

archive.tgz has ~30 GB. How do you list content of it and extract only one file?

DONTKNOW tar tf archive.tgz to list tar xf archive.tgz filename to extract

Execute combine multiple shell commands in one line.

command1 && command2 ; command3 | command4

What symbolic representation can you pass to chmod to give all users execute access to a file without affecting other permissions?

chmod a+x or chmod xx5

How can I sync two local directories?

rsync dir1 dir2

Many basic maintenance tasks require you to edit config files. Explain ways to undo the changes you make.

Backup the file beforehand. ADDON use git

You have to find all files larger than 20MB. How you do it?

find -type f -size +20M

Why do we use sudo su - and not just sudo su?

the - means that we reload a new shell for the root user, environment is reset, its cleaner

How to find files that have been modified on your system in the past 60 minutes?

find -type f -mtime +600

What are the main reasons for keeping old log files?

For legal reasons. Also to trace back a problem that has gone under the radar for too long.

What is an incremental backup?

A backup where we start from a full backup and then write only the delta, eg what has changed since last backup. Allows to reconstruct the file while using less space.

What is RAID? What is RAID0, RAID1, RAID5, RAID6, RAID10?

RAID (ADDON Redudant Array of Inexpensive Disks) allows to use multiple disks as one storage device. RAID0 is striping, RAID1 is mirror, RAID5 is striping 3 disks with parity, RAID6 same with 4 disks, RAID10 is 1 + 0. ADDON RAID5 allows to lose one disk, since we can then reconstruct with parity; RAID6 is the same but we can lose two disks since we had a parity sector.

How is a user’s default group determined? How would you change it?

DONTKNOW can be changed with useradd -m -g initial_group username. Otherwise it depends on the USERGROUPS_ENAB env var. if yes the default group will have the name of the user.

What is your best command line text editor for daily working and scripting? ***

Vim is my editor, it is powerful and widely available, highly configurable.

Why would you want to mount servers in a rack?

Space management, heat management, Power management, Easier to move around, Cable management, etc

Network

Draw me a simple network diagram: you have 20 systems, 1 router, 4 switches, 5 servers, and a small IP block. ***

Hur, can't do that here but you need 32 adresses available so a /27.

What are the most important things to understand about the OSI (or any other) model?

Encapsulation ? Each layer is encapsulated in the one above it. It provides abstraction of the whole thing. ADDON Protocols divide into layers. Layers allow decoupling functions from each other.

What is the difference between a VLAN and a subnet? Do you need a VLAN to setup a subnet?

A VLAN is a way to prevent a part of the network from speaking directly to another. You do not need vlans to have subnets, although it's a good idea. ADDON VLAN is layer 2 et subnet layer 3. VLAN prevents broadcasts from spreading too much.

List 5 common network ports you should know.

80, 442, 53, 22, idk

What POP and IMAP are, and how to choose which of them you should implement?

Email MTA protocols. Basically POP gets a local copy of a mail while IMAP reads them directly on the server. POP is generally used with "heavy" clients, and prevents users from deleting their emails from the servers. IMAP should be used when space is limited.

How to check default route and routing table?

route -n gives the default gateway, otherwise don't remember; could check conf files. ADDON ip route show

What is the difference between 127.0.0.1 and localhost?

They're basically the same, except 127/8 is reserved solely for the purpose for accessing oneself. Also, localhost is defined in a conf file. ADDON so localhost must be resolved one way or another.

Which port is used for ping command?

None. ICMP has no ports.

Server A can't talk to Server B. Describe possible reasons in a few steps.

Ip configuration, Gateway configuration, DNS, router issue, cable issue ADDON basically we go down the DOD model layer by layer : Application (services up ?) Transport (Ports opened ?) Network (IP, gateway, etc ?), Physical (cable, NIC ?)

Why won’t the hostnames resolve on your server? Fix this issue. ***

Look at /etc/resolv.conf. if needed, add a server here. Maybe look at nsclient also.

How to resolve the domain name (using external dns) with CLI? Can IPs be resolved to domain names?

host xxx or dig

How to test port connectivity with telnet or nc?

telnet host port or nc host port.

Why should you avoid telnet to administer a system remotely?

It's not encrypted.

What is the difference between wget and curl?

Wget downloads files from the web, recursively. curl outputs the HTML and also works with other protocols.

What is SSH and how does it work?

SecureShell. Allows one to remotely work on another machine in a secure machine, encrypting the comms. Client speaks to daemon.

Most tutorials suggest using SSH key authentication rather than password authentication. Why it is considered more secure?

No need to remember a password (that could be weak due to human memory...). Keys are harder to bruteforce : you need the private key. Removing password connection removes the need to protect against bruteforce.

What is a packet filter and how does it work?

Firewall filters packet based on source / dest / protocol / etc. ADDON used to control network access between two nets.

What are the advantages of using a reverse proxy server?

Allows to expose only one point to the outside, allows to filter every connection coming to our servers, SSL offloading, easier to manage adding / remove websites, allows redundancy by mutliplying backends... ADDON allows transparent maintenance

What is the difference between a router and a gateway? What is the default gateway?

A router is a device, an appliance, that is used a gateway. A gateway is merely a configuration line in a computer's networking config. Default gateway is the address a computer will send its packets when it needs to send them to another network (and as has no further instructions).

Explain the function of each of the following DNS records: SOA, PTR, A, MX, and CNAME.

SOA is Source Of Authority, defines what DNS server has authority over the domain. PTR points to another DNS server having authority over another domain. A defines which IP has which FQDN. MX is mail exchanger for the domain. CNAME is an alias. WRONG SOA is Start of Authority. ADDON AAAA for ipv6. WRONG PTR is for reverse dns, NS is name server records.

Why couldn't MAC addresses be used instead of IPv4/6 for networking?

Connection would be limited to local links, basically; no way to pass a gateway.

What is the smallest IPv4 subnet mask that can be applied to a network containing up to 30 devices?

/27 since we need 32 addresses

What are some common HTTP status codes?

2xx success, 4xx external error, 5xx internal (server) error