Atlantic.Net Blog

How to: FreeBSD User Administration

Verified and Tested 08/18/15

Introduction

Imagine that you give a copy of your house keys to all of your family members and all of your friends. You get home one day, and it’s been vandalized. Who will you go to for information? It would be chaotic! So you only give your house keys to special people who you trust. In the same way in a network user administration works the same way. It adds a level of security and the peace of mind that if something happens you know who has access to your systems. There are main two types of users commonly used worldwide. You have plain users that have limited access to what they can access and you have super users or admin users that have extra permissions to perform system updates, installs and many other management tasks that normal users can’t. In this how-to we will go through the basics of User Management in FreeBSD and make sure that only users we want to have keys have them.


Prerequisites

You need a FreeBSD server that is configured with a static IP address. If you do not have a server, try our SSD VPS Hosting get going in under 30 seconds.

Adding users in FreeBSD

For server management, it is recommended that you at least have one user for the server besides the default root account. If you want, add a user or multiple users in FreeBSD you can accomplish this with the following command replacing NAME with the user that you want. (Note: You will be prompted to fill out information about that user, fill out whatever is applicable)

adduser NAME

Root Privileges to Users in FreeBSD

You now have the option to select the type of account you want for your user. You can leave it as a regular user account, or you can add that user root permissions adding that user to the “super user” account with the following:

sudo pw groupmod wheel -m USER1

Removing users in FreeBSD

Once you have no use for a specific user, whether it was a previous employee, a colleague or any other type of user. You can simply remove them in FreeBSD with the following command replacing NAME with that user.

rmuser NAME

Changing user passwords in FreeBSD

There are two ways to change a users password in FreeBSD. You can change it as the root user or the actual user. If you are the root user or have root privileges, you can change a specified users password with the following command replacing NAME with that user.

passwd NAME

If you are the actual user and want to change your current password, you can simply your password with the following command:

passwd

Locking users in FreeBSD

In a networked environment when you have active users or customers, you have the ability to lock and unlock their accounts. To lock a user in FreeBSD, you can type the following command:

pw lock USER1

If you want to reactivate a user in FreeBSD, this can be completed with the following command:

pw unlock USER1

Active Users list in FreeBSD

Since you could have more than one user logged in simultaneously, you have the ability to view a list of all the users that are currently logged in to the system with the following command:

who

Resetting the root password in FreeBSD

In the event of an emergency and you forget or misplaced your systems root password. There is a way that you could manually change/update it by completing the following steps.

1. Log into the server selecting “single user mode.”

2. From the options available, select shell, and press enter.

3. Once in shell run the following command:

mount -a

4. Then you can change your password with the following command:

passwd

5. Finally, you will need to reboot the server to apply the changes with the following command:

reboot

What Next?

Congratulations! You have just learned the basics of User Administration in FreeBSD. Thank you for following along this how-to!  Feel free to check back with us for further updates and browse our many different VPS hosting options.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year