Sobes.tech
Junior — Middle

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:

  1. The useradd command — 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 username
    

    The -m option creates the home directory.

  2. The adduser command — a more user-friendly script that interactively helps create a user, setting passwords and other parameters.

    sudo adduser username
    
  3. Manual editing of files — less common, but you can manually add entries to /etc/passwd, /etc/shadow, and /etc/group.

  4. Using graphical utilities — in GUI-based distributions, system settings can be used to add users.

  5. 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.