Imagine FreeBSD as a boarding house. As the landlord, you need to know who’s living there (users), who’s in the same clique (groups), who’s allowed in the kitchen, who’s just chilling on the porch, and who definitely shouldn’t touch the system’s fridge.
In FreeBSD, all of that is handled with user and group management. So let’s get to know how to manage them like a pro (or a fun landlord).
1. Adding a User
The classic (interactive) way:
adduser
This command walks you through everything—name, password, favorite shell, which group to join. Super friendly for beginners.
The fast (direct) way:
pw useradd username -m -s /bin/tcsh -G wheel
Meaning:
-
-m
: create a home directory -
-s
: assign a shell -
-G
: assign to a group (e.g.,wheel
= admin group)
Example:
pw useradd naruto -m -s /bin/sh -G wheel
2. Setting a Password
Don’t forget to set a password after creating a user:
passwd username
Example:
passwd naruto
If you're root, you can set anyone’s password—even if they’re AFK.
3. Deleting a User
pw userdel username
If you also want to remove their home directory:
pw userdel username -r
Example:
pw userdel sakura -r
Don’t worry, it’s not personal—it’s just housekeeping
4. Group Management
Add a new group:
pw groupadd mygroup
Add a user to a group:
pw groupmod mygroup -m naruto
Remove a user from a group:
pw groupmod mygroup -d naruto
View group contents:
grep mygroup /etc/group
Or check a user’s groups:
id naruto
5. The wheel
Group = The Admin Club
If you want a user to be able to use su
and switch to root, they must be in the wheel
group.
This is the elite squad that gets access to system-level privileges.
Add user to wheel:
pw groupmod wheel -m naruto
6. Important Configuration Files
-
/etc/passwd
→ basic user info -
/etc/group
→ group list -
/etc/master.passwd
→ detailed user info (including encrypted password) -
/etc/login.conf
→ resource limits (CPU, memory, etc.)
Warning: Don’t edit these files manually unless you know what you’re doing. Use vipw
or the pw
tool for safety.
User and group management in FreeBSD is essential for keeping your system secure, tidy, and civilized. You don’t want every user to have root access—unless you’re running a chaos simulation
With the basic commands above, now you can:
Add users
Set passwords
Create groups
Add users to groups
Remove users when they’ve graduated from the system
0 Comments:
Post a Comment