cmd/adduser: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< cmd
No edit summary
No edit summary
 
Line 4: Line 4:
{{l/cmd|adduser}} is a command for creating users on a [[Debian]]-based system. It is somewhat higher-level than the {{l/cmd|useradd}} command.
{{l/cmd|adduser}} is a command for creating users on a [[Debian]]-based system. It is somewhat higher-level than the {{l/cmd|useradd}} command.
* '''manpages''': [https://manpages.ubuntu.com/manpages/xenial/en/man8/adduser.8.html Ubuntu], [https://linux.die.net/man/8/adduser die.net]
* '''manpages''': [https://manpages.ubuntu.com/manpages/xenial/en/man8/adduser.8.html Ubuntu], [https://linux.die.net/man/8/adduser die.net]
==Example==
This should add a new user with sudo privileges, no password, and skips the interactive prompts (but I have not tested it yet):
{{fmt/arg/opt|sudo}} adduser --disabled-password --gecos "" {{fmt/arg|username}}
{{fmt/arg/opt|sudo}} usermod -aG sudo {{fmt/arg|username}}
* The "sudo" is optional if you are acting as root.
* "<code>--disabled-password</code>" sets the password field to "<code>!</code>", which apparently disables all password authentication.
* the "sudo" group (in the 2nd command) is for [[Debian]]-derived Linux flavors; [[Red Hat]] flavors apparently use the "wheel" group.
==Related==
==Related==
* {{l/cmd|usermod}}
* {{l/cmd|usermod}}

Latest revision as of 13:27, 25 June 2026

<hide> page type::reference thing type::command platform::Linux </hide>

Basics

adduser is a command for creating users on a Debian-based system. It is somewhat higher-level than the useradd command.

Example

This should add a new user with sudo privileges, no password, and skips the interactive prompts (but I have not tested it yet):

[ <sudo> ] adduser --disabled-password --gecos "" <username>
[ <sudo> ] usermod -aG sudo <username>
  • The "sudo" is optional if you are acting as root.
  • "--disabled-password" sets the password field to "!", which apparently disables all password authentication.
  • the "sudo" group (in the 2nd command) is for Debian-derived Linux flavors; Red Hat flavors apparently use the "wheel" group.