Bantuan

Bantuan GoDaddy

How to add a user to a group in Ubuntu 14.04

Linux operating systems, including Ubuntu, CentOS and others, use groups to provide users with access rights to objects such as files and directories. These groups are independent of each other without any specific relationships between them. Adding a user to a group is a routine task for system administrators.

DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
TIME REQUIRED 5 min
RELATED PRODUCTS Ubuntu-based VPS or dedicated servers

Here is a quick tutorial on how to add a user to a group in Ubuntu 14.04.

Sign into your server as root.

If you need any help with this, see Switching to the Root User on Your Linux Server.

Create a group and user

Create a group called "testgroup" with the groupadd command:

$ groupadd testgroup

Create a user called testuser and add it to testgroup with the following useradd command:

$ useradd -g testgroup testuser

Verify the creation of the group and user

Display the user and group information for testuser with the id command:

$ id testuser
uid=1001(testuser) gid=1001(testgroup) groups=1001(testgroup)

Display the groups to which testuser belongs with this groups command:

$ groups testuser

Apakah Artikel Ini Berguna?
Terima kasih atas masukan Anda. Untuk berbicara dengan perwakilan layanan pelanggan, hubungi nomor ponsel dukungan atau gunakan opsi chatting di atas.
Senang bisa membantu! Ada hal lain yang dapat kami lakukan untuk Anda?
Maaf tentang hal tersebut. Sampaikan apa yang membuat Anda bingung atau mengapa solusi tersebut tidak mengatasi masalah Anda.