Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | Yes |
Requirements | pw+FreeBSD |
Time | N/A |
Syntax
The syntax is as follows to remote the user account under FreeBSD operating systems:
pw deluser user-name-here pw userdel user-name-here
Examples
To delete or remove tom user account from the system, enter:
# pw userdel tom
Removing home directory and other files
The -r option tells pw command to remove the user’s home directory and all of its contents. From the pw man page:
The pw utility errs on the side of caution when removing files from the system. Firstly, it will not do so if the uid of the account being removed is also used by another account on the system, and the ‘home’ directory in the password file is a valid path that commences with the character /. Secondly, it will only remove files and directories that are actually owned by the user, or symbolic links owned by anyone under the user’s home directory. Finally, after deleting all contents owned by the user only empty directories will be removed. If any additional cleanup work is required, this is left to the administrator. Mail spool files and crontabs are always removed when an account is deleted as these are unconditionally attached to the user name. Jobs queued for processing by at are also removed if the user’s uid is unique and not also used by another account on the system.
To delete jerry user account and home directory from the system, enter:
# pw userdel tom -r
Use UID instead of username
The syntax is:
pw userdel UID-HERE pw userdel -u uid -r pw userdel UID-HERE [options] ## delete user having UID # 333 pw userdel 333 -r
Type the following command to read the pw command man page:
$ man pw
🐧 2 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
What about “rmuser” command?
Thanks