Managing user accounts is an essential system administration task. You may need to create a separate account for another person, grant administrative privileges, change a password, or remove an account that is no longer needed.
In this guide, you will learn how to:
- Create a new user account.
- Grant administrative privileges to a user.
- Change a user’s password.
- Delete a user account while keeping or removing its files.
How to Create a New User in FunOS
The easiest way to create a user in FunOS is with the adduser command. This interactive command creates the account, sets up its home directory, and asks you to create a password.
Step 1: Open a Terminal
You can open a Terminal in any of the following ways:
- Click Menu in the lower-left corner of the screen, then click Terminal.
- Click the Terminal icon in the Tray.
- Press Ctrl + Alt + T.
Step 2: Create the User
Run the following command, replacing username with the username you want to create:
sudo adduser username
For example, to create a user named john, run:
sudo adduser john
You will be asked to enter and confirm a password for the new user. The command may also ask for optional information such as the user’s full name and phone number. You can press Enter to leave these fields blank.
The command automatically:
- Creates the new user account.
- Creates the user’s home directory, such as
/home/john. - Copies the default configuration files into the home directory.
- Sets the user’s default login shell.
- Prompts you to create a password.
How to Grant Administrative Privileges
A newly created user does not have administrative privileges by default.
To allow the user to run administrative commands with sudo, add the account to the sudo group:
sudo usermod -aG sudo username
For example:
sudo usermod -aG sudo john
The options used in this command are:
-a: Appends the user to the specified group without removing existing group memberships.-G: Specifies one or more supplementary groups.
The user must log out and log back in before the new group membership takes effect.
You can verify the user’s group memberships with:
groups username
For example:
groups john
How to Add a User to Other Groups
You can grant access to additional system features by adding the user to the appropriate groups.
For example:
sudo usermod -aG lpadmin,sambashare john
Some commonly used groups include:
sudo: Allows the user to run administrative commands.adm: Allows access to certain system log files.cdrom: Allows access to optical drives.dip: Provides access to certain networking and dial-up devices.plugdev: Provides access to some removable devices.lpadmin: Allows the user to manage printers.sambashare: Allows the user to manage Samba file shares.
Only add users to groups they actually need. Membership in groups such as sudo grants additional access to the system.
How to Change a User’s Password
To set or change a user’s password, run:
sudo passwd username
For example:
sudo passwd john
Enter the new password when prompted, then enter it again to confirm it.
The password will not be displayed while you type.
Alternative Method: Creating a User with useradd
FunOS also includes the lower-level useradd command.
For example:
sudo useradd -m -s /bin/bash john
sudo passwd john
In this command:
-mcreates the user’s home directory.-s /bin/bashsets Bash as the user’s login shell.johnis the username.
You can create the account and add it to supplementary groups at the same time:
sudo useradd -m -s /bin/bash -G sudo,lpadmin,sambashare john
sudo passwd john
Although useradd provides more direct control, adduser is generally easier for creating regular user accounts because it guides you through the process interactively.
How to Delete a User in FunOS
Before deleting an account, make sure the user is logged out and back up any files you want to keep.
You must decide whether to:
- Delete only the user account while keeping its home directory.
- Delete the account together with its home directory and mail files.
Delete a User but Keep the Home Directory
Run:
sudo deluser username
For example:
sudo deluser john
This removes the user account but normally leaves the user’s home directory, such as /home/john, intact.
Keeping the home directory can be useful when you want to preserve the user’s personal files.
Delete a User and Their Home Directory
To remove the account together with its home directory, run:
sudo deluser --remove-home username
For example:
sudo deluser --remove-home john
This removes:
- The user account.
- The user’s home directory and its contents.
- The user’s mail spool, when present.
Warning: Files removed with this command may be difficult or impossible to recover. Check the home directory and create a backup before continuing.
Alternative Method: Deleting a User with userdel
You can also use the lower-level userdel command.
To delete an account while keeping its home directory:
sudo userdel john
To delete the account and remove its home directory and mail spool:
sudo userdel -r john
The -r option removes the user’s associated home directory and mail files.
How to Back Up a User’s Home Directory Before Deletion
Before removing an account, you can move its home directory to another location.
First, create a directory for backups if it does not already exist:
sudo mkdir -p /backup
Move the user’s home directory:
sudo mv /home/john /backup/john-home-backup
You can then delete the account:
sudo deluser john
Alternatively, create a compressed archive instead of moving the directory:
sudo tar -czf /backup/john-home-backup.tar.gz /home/john
After confirming that the archive was created successfully, you can remove the account and its home directory:
sudo deluser --remove-home john
Conclusion
FunOS provides standard Ubuntu and GNU/Linux commands for managing user accounts.
The adduser and deluser commands provide a convenient way to create and remove regular user accounts. The lower-level useradd and userdel commands are also available when you need more direct control.
When managing users:
- Use
adduserto create a regular user account. - Add the user to the
sudogroup only when administrative access is required. - Use
passwdto set or change a password. - Back up important files before deleting an account.
- Use
deluser --remove-homeonly when you are certain the user’s personal files are no longer needed.
By using these commands carefully, you can manage user accounts in FunOS safely and efficiently.