To delete a user account on a FreeBSD system, you can use the pw
command with the userdel
option. For example:
pw userdel username
Replace username
with the name of the user you want to delete.
This command will delete the user account and remove the user's home directory. If you want to keep the user's home directory, you can use the -r
option to prevent the home directory from being deleted:
pw userdel -r username
It's important to note that deleting a user account does not automatically remove any files or directories owned by the user. If you want to remove these files as well, you can use the find
command to locate and delete the files. For example:
find / -user username -exec rm -rf {} \;
This will delete all files and directories owned by the user username
. Be careful when using this command, as it can delete important files if you are not careful.