Adding a user to a group

Synopsis

This article describes how to add a Linux user (account) to a group.

Environment

Any Gentoo Linux environment not using a centralized account management tool (like LDAP).

root #grep ^group /etc/nsswitch.conf
group:   compat

Analysis

Unless defined otherwise, groups and group membership are managed through the /etc/group file. Some systems have accounts managed through a centralized resource (such as an LDAP directory). The /etc/nsswitch.conf file defines where the system looks for group membership.

When using a centralized user repository, the resolution given below might not work.

Resolution

Although you can directly edit /etc/group, it is much easier (and less error prone) to use the gpasswd command.

For instance, to add the user "larry" to the wheel group:

root #gpasswd -a larry wheel
  • 0 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

SSH login without password

You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic login...

How to remove a Linux user

How do I drop or remove old users account from my Linux server? I can login using the user’s SSH...

How to restrict and except SSH access to specific IPs

Once your IP is public it gets attention from so many bots in the internet that do brute force...

How to lock and unlock user account in linux

With the help of two commands you can lock and unlock the user account in Linux. To Lock the...

Create a user with no password

This article shows you how to create a user account without a password or an empty password on...

Powered by WHMCompleteSolution