Summary
Highlights
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.
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'.
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]'.
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.
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.