Users are one of the core concepts in Linux. It’s the main entity Linux uses to apply permissions to, so that files and processes are appropriately owned, separated, controlled, and protected.
Common Linux User Interview Questions
There are usually not a ton of Linux User questions in most job interviews, unless you are applying for a job role that has to do extremely in-depth work with end-user permissions, Access Control Lists, (ACLs), shared storage like NFS or Samba/SMB, and other highly specialized Linux Engineering roles where managing the relation of users to permissions is extremely important.
Here are the most common questions you might see, along with answers:
How would you create a Linux user?
The answers we expect to hear for this question are:
- adduser – a relatively full-featured user-creation wizard, good for one-offs. Automatable. Not installed by default on many Linux distributions.
- useradd – a more primitive, noninteractive program found on most Linux distributions.
- configuration management software (chef, puppet, ansible, etc.) – if you are working at scale and automatically configuring images, this is the answer your interviewer will want to hear. It is not feasible to manually create users across hundreds of systems on-demand (possible via a quick bash script, but not advisable as a business process), so you want an automated, well-documented, manageable process to ensure that the users you need exist on the systems that require them.
- In a Dockerfile – a possible answer to some trick questions involving situations where you need to ensure a certain user exists in a Linux container environment.
What is a ‘user’ in Linux made of? If you wanted to manually create a user, which files would you have to edit? If you weren’t allowed to use useradd on Linux, how would you create a Linux user?
This is an unlikely but fun question. Fun, because it shows how simple the construct of a Linux user is. When you use a user-creation utility, all it’s doing is modifying three files (/etc/group, /etc/shadow, /etc/passwd) and then optionally creating a directory in /home and copying some files from /etc/skel.