Linux – /are the standard CLI program(s) to manage users and groups

linuxusersUtilities

I'm basically asking about user management from the command line (e.g. on a system where there are no graphical tools available). In the past I've used several different programs to add or delete users and groups or to modify their attributes: adduser, useradd, usermod, gpasswd, and perhaps others I've forgotten. I've also heard a couple times that some of these programs are low-level and should be avoided for general use, but I can never remember which. So I'd like to get a definitive answer for which programs are the recommended ones for at least the following tasks:

  • Create a new user
  • Add a user to a group
  • Remove a user from a group
  • Change a user's primary group
  • Change a user's login shell or home directory
  • Delete a user

I'm looking for standard tools which I can expect to be available on pretty much any Linux system (of any distribution).

Best Answer

Sadly, none of those operations were ever standardized.

Some operating systems offer this functionality as part of the OS, like Linux, but even if your Linux system includes them, over time and across Linux distributions the tools and their names changed so you can not really depend on a standard set of tools to do those tasks.

You need to have a per-operating system set of tools.

Related Question