0Pricing
Linux Command Line Mastery · Pelajaran

Pengelolaan Pengguna dan Grup: `useradd`, `usermod`, `groupadd`

Pelajari cara membuat, mengubah, dan menghapus akun pengguna serta grup pada mesin Linux.

Pengelolaan Pengguna dan Grup: `useradd`, `usermod`, `groupadd` adalah pelajaran Linux Command Line Mastery gratis di CoddyKit. Ini adalah pelajaran 1 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar Linux Command Line Mastery, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Linux Command Line Mastery mencakup 4 pelajaran total.

Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

Welcome to User Management

In Linux, managing users and groups is crucial for security and organization. Every file and process has an owner, and permissions are often set based on user and group affiliations.

This lesson will teach you how to create, modify, and remove user accounts and groups.

Creating New Users: `useradd`

The useradd command creates a new user account. By default, it creates a new primary group with the same name as the user and assigns a unique User ID (UID).

You'll often need sudo (superuser do) privileges to run this command.

sudo useradd newuser

Customizing Users: Home & Shell

When you create a user, you might want to specify their home directory and default shell. The -m option creates the user's home directory if it doesn't exist, and -s sets their login shell.

Without -m, no home directory is created, which can cause issues.

sudo useradd -m -s /bin/bash devuser

Verifying User Details: `id`

After creating a user, you can verify their existence and check their User ID (UID) and Group IDs (GIDs) using the id command. This helps confirm the account was set up correctly.

id devuser

Understanding Linux Groups

Groups are collections of users. They simplify permission management, allowing multiple users to share access to files and resources without individually setting permissions for each user.

Each user has a primary group (often named after the user) and can belong to multiple supplementary groups.

Creating New Groups: `groupadd`

To create a new group, you use the groupadd command. This is useful for organizing users into functional teams, like 'developers' or 'admins', and then assigning file permissions to that group.

sudo groupadd project_team

Adding Users to Groups: `usermod`

The usermod command modifies an existing user account. To add a user to a supplementary group, use the -aG (append to Group) option.

Remember, -a must be used with -G to append, otherwise -G alone would overwrite existing supplementary groups!

sudo usermod -aG project_team devuser

Modifying User Accounts: `usermod`

Beyond adding to groups, usermod can change various user properties. For example, you can change a user's primary group using -g or update their full name/comment using -c.

Always be careful when modifying user accounts, especially sensitive information.

sudo usermod -c "Developer for Project X" devuser

Removing Users and Groups

To remove a user account, use userdel. The -r option is commonly used to remove the user's home directory and mail spool along with the account.

To remove a group, use groupdel. A group cannot be removed if it's the primary group for any existing user.

sudo userdel -r olduser
sudo groupdel oldgroup

Quick Check: User & Group Commands

Which of the following commands would you use to add an existing user named analyst1 to a new supplementary group named data_team?

Recap: User & Group Management

Congratulations! You've learned the essentials of user and group management in Linux.

  • useradd creates new user accounts.
  • groupadd creates new groups.
  • usermod modifies existing user accounts and can add users to supplementary groups using -aG.
  • userdel and groupdel remove users and groups, respectively.

These commands are fundamental for system administration and maintaining a secure Linux environment.

Pertanyaan yang Sering Diajukan

Apakah pelajaran “Pengelolaan Pengguna dan Grup: `useradd`, `usermod`, `groupadd`” gratis?

Ya — teks lengkap “Pengelolaan Pengguna dan Grup: `useradd`, `usermod`, `groupadd`” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Linux Command Line Mastery, upgrade ke CoddyKit PRO. Kursus Linux Command Line Mastery mencakup 4 pelajaran total.

Apa yang akan aku pelajari di “Pengelolaan Pengguna dan Grup: `useradd`, `usermod`, `groupadd`”?

Pelajari cara membuat, mengubah, dan menghapus akun pengguna serta grup pada mesin Linux. Kamu berlatih Linux Command Line Mastery dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.

Apakah aku perlu pengalaman untuk memulai Linux Command Line Mastery?

Tidak diperlukan pengalaman sebelumnya. Linux Command Line Mastery di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 1 dari 4.

Berapa lama pelajaran “Pengelolaan Pengguna dan Grup: `useradd`, `usermod`, `groupadd`” memakan waktu?

Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.

Bisakah aku menulis dan menjalankan kode dalam pelajaran Linux Command Line Mastery ini?

Ya. Setiap pelajaran Linux Command Line Mastery menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.

Semua pelajaran dalam kursus ini

  1. Pengelolaan Pengguna dan Grup: `useradd`, `usermod`, `groupadd`
  2. Pengantar Perintah Jaringan: `ping`, `ip`, `netstat`
  3. Akses Jarak Jauh yang Aman: `ssh` dan `scp`
  4. Izin dan Kepemilikan Berkas dengan chmod dan chown
← Kembali ke Linux Command Line Mastery