Configuration files
Where a system's and a user's settings live, the common formats (key=value, INI, YAML, JSON), the priority order of the sources and the need to reload the service.
- 24 cards
- 4 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
A few cards from the deck
Configuration file: what is it?
Show the answer
A text file that holds a program's settings, read at launch to decide its behaviour without changing the program itself.
On Linux, the system's live in
/etcand a user's in their home directory. A syntax error in one can stop the program from starting.lsdoes not list the.bashrcfile in the home directory. Which command shows it?ls -als -lls -Rls -h
Show the answer
ls -a-alists everything, including names that start with a dot.-ladds details without revealing hidden files,-Rdescends into subdirectories,-hmakes sizes readable.To add settings without touching the main file, many programs also read every file in a directory whose name ends in ….
Show the answer
To add settings without touching the main file, many programs also read every file in a directory whose name ends in .d.
For example
/etc/apt/sources.list.d/next to/etc/apt/sources.list. Each file in the directory contributes a piece of configuration: a package can add or remove its own without rewriting a shared file.Hidden file: what is it?
Show the answer
A file or directory whose name starts with a dot, which
lsdoes not list without the-aoption, and which programs use for a user's settings.~/.bashrc,~/.gitconfigand~/.ssh/are examples. The dot is only a display convention: it does not protect the file.The port was changed in sshd_config, but the service still listens on port 22. What are the most likely cause and fix?
- The service has not reread its file; restart it with systemctl
- The file is only read when the machine boots; the whole system must be restarted
- The user's ~/.sshd_config file takes over from the system's; delete it
- Port 22 is reserved for SSH; changing it requires recompiling the server
Show the answer
The service has not reread its file; restart it with systemctl
A service keeps its settings in memory since launch. After a change,
sudo systemctl restart ssh(the service name on Debian) rereads them; on recent Ubuntu releases, wheressh.socketdoes the listening, you needsudo systemctl daemon-reloadthensudo systemctl restart ssh.socket. Rebooting the machine would work, but is out of proportion. Testing withsudo sshd -tbefore restarting the service avoids locking yourself out remotely.