Setting Up User Accounts and Passwords on Linux Mint

Categories:
4 minute read
Linux Mint provides a robust user management system that allows you to create, modify, and secure user accounts effectively. This comprehensive guide will walk you through everything you need to know about managing user accounts and passwords in Linux Mint, from basic setup to advanced security configurations.
Understanding User Account Types
Before diving into the setup process, it’s important to understand the two main types of user accounts in Linux Mint:
Regular users have limited permissions and can only modify their own files and settings. They need to use sudo for administrative tasks, making this account type ideal for daily use and enhancing system security.
Administrative users (sudo users) have the ability to perform system-wide changes when needed. The first user account created during Linux Mint installation automatically receives administrative privileges through sudo access.
Creating New User Accounts
Using the Graphical Interface
The simplest way to create new user accounts is through Linux Mint’s graphical Users and Groups tool:
- Open the Start Menu and search for “Users and Groups”
- Click the “Add” button (you’ll need to enter your password)
- Fill in the required information:
- Username (must be lowercase, no spaces)
- Full name (the display name)
- Password
- Choose the account type (Standard or Administrator)
- Click “Add User” to create the account
Using the Command Line
For those who prefer terminal commands, you can create users with these steps:
# Create a new user
sudo adduser username
# Add user to sudo group (for administrative privileges)
sudo usermod -aG sudo username
The adduser command will prompt you for:
- Password
- Full name
- Room number (optional)
- Work phone (optional)
- Home phone (optional)
- Other information (optional)
Setting Up Strong Passwords
Password Best Practices
When creating passwords for Linux Mint accounts, follow these security guidelines:
- Use at least 12 characters
- Include a mix of:
- Uppercase letters
- Lowercase letters
- Numbers
- Special characters
- Avoid common words or personal information
- Use unique passwords for each account
Changing Passwords
Users can change their own passwords in several ways:
Graphical Method
- Open System Settings
- Select “Users and Groups”
- Click on the password field
- Enter the current password
- Enter and confirm the new password
Command Line Method
# Change your own password
passwd
# Change another user's password (requires sudo)
sudo passwd username
Managing Account Security
Password Policies
To enforce strong passwords, you can set up password policies using the PAM (Pluggable Authentication Modules) system:
- Install the password quality checking library:
sudo apt install libpam-pwquality
- Edit the PAM configuration file:
sudo nano /etc/pam.d/common-password
- Add or modify the password requirements line:
password requisite pam_pwquality.so retry=3 minlen=12 difok=3 ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1
This configuration:
- Allows 3 password change attempts
- Requires minimum 12 characters
- Requires at least 3 character changes in new passwords
- Requires at least 1 uppercase letter
- Requires at least 1 lowercase letter
- Requires at least 1 digit
- Requires at least 1 special character
Account Lockout Settings
To protect against brute force attacks, configure account lockout:
- Edit the PAM configuration:
sudo nano /etc/pam.d/common-auth
- Add the following line:
auth required pam_tally2.so deny=5 unlock_time=1800
This locks accounts for 30 minutes after 5 failed login attempts.
Managing Existing Accounts
Modifying User Properties
To modify existing user accounts:
Graphical Method
- Open Users and Groups
- Select the user to modify
- Make changes to:
- Account type
- Password
- Language
- Auto-login settings
Command Line Method
# Change username
sudo usermod -l newname oldname
# Change home directory
sudo usermod -d /home/newname username
# Change shell
sudo usermod -s /bin/bash username
Deleting User Accounts
When removing users, you can choose to keep or delete their home directory and files:
Graphical Method
- Open Users and Groups
- Select the user
- Click “Delete”
- Choose whether to keep home directory files
Command Line Method
# Keep home directory
sudo userdel username
# Delete home directory and mail spool
sudo userdel -r username
Maintaining Account Security
Regular Security Audits
Perform these security checks regularly:
- Review user accounts and remove unnecessary ones:
cat /etc/passwd
- Check sudo users:
getent group sudo
- Review login attempts:
sudo lastlog
- Check failed login attempts:
sudo fail2ban-client status
Password Maintenance
Implement these password security practices:
- Set password expiration:
sudo chage -M 90 username # Expires after 90 days
- Force password change at next login:
sudo chage -d 0 username
- View password status:
sudo chage -l username
Troubleshooting Common Issues
If you encounter problems, try these solutions:
Forgotten password:
- Boot into recovery mode
- Mount the system in read-write mode
- Use passwd command to reset the password
Account locked out:
- Login as root or another admin user
- Reset failed login count:
sudo pam_tally2 --user=username --reset
Sudo access issues:
- Verify group membership:
groups username
- Add to sudo group if necessary:
sudo usermod -aG sudo username
By following these guidelines and best practices, you can maintain a secure and well-organized user account system on your Linux Mint installation. Remember to regularly review and update your security settings to protect against new threats and vulnerabilities.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.