What methods are used to add new users to a Linux system?
sobes.tech AI
Answer from AI
In Linux, adding new users is usually done by the following methods:
-
The
useraddcommand — the standard way to add a user. It creates a new account, home directory (if specified), and adds an entry to/etc/passwd.sudo useradd -m usernameThe
-moption creates the home directory. -
The
addusercommand — a more user-friendly script that interactively helps create a user, setting passwords and other parameters.sudo adduser username -
Manual editing of files — less common, but you can manually add entries to
/etc/passwd,/etc/shadow, and/etc/group. -
Using graphical utilities — in GUI-based distributions, system settings can be used to add users.
-
Automation through scripts and configuration managers — for example, Ansible, Puppet, Chef for bulk user addition.
Thus, the most common methods are the useradd and adduser commands.