Perintah Linux | Kelola pengguna dengan useradd dan usermod

Share

Summary

This video discusses two essential Linux commands: 'useradd' for creating new users and 'usermod' for modifying existing user accounts. It covers basic user creation, setting passwords, specifying home directories, adding users to groups, and renaming users, all demonstrated on an Amazon Web Services EC2 instance.

Highlights

Introduction to 'useradd' Command
00:00:31

The 'useradd' command is used to add new users to a Linux system. The basic format is 'sudo useradd [username]'. The video demonstrates creating a user named 'depok' and setting a password for them using 'sudo passwd depok', allowing the new user to log in.

Default Home Directory and Customizing 'useradd'
00:03:06

By default, 'useradd' creates a home directory for the new user under '/home/'. The video shows how to specify a different home directory using the '-m -d' options, for example, creating a user 'depok2' with a home directory at '/opt/depok2'.

Introduction to 'usermod' Command
00:06:36

The 'usermod' command is used to modify existing user accounts. A common use case is adding a user to a specific group. The general syntax is 'sudo usermod -aG [groupname] [username]'.

Adding Users to Groups with 'usermod'
00:07:05

The video demonstrates adding the 'depok' user to the 'wheel' group (equivalent to 'sudo' on Red Hat-based systems like Rocky Linux). This grants the user sudo privileges. The 'groups' command is used to verify the user's group memberships.

Changing Primary Group and Renaming Users with 'usermod'
00:09:57

The 'usermod' command can also change a user's primary group using the '-g' option. For example, changing 'depok's' primary group to 'newgroup'. Additionally, it can be used to rename a user with the '-l' option, specifying the new username and then the old username.

Recently Summarized Articles

Loading...