Need to manage users on your Ubuntu VPS? This quick guide will show you how to list all user accounts. [buy VPS hosting] for easy server administration! Fret not as that is what we are going to discuss here in detail. Ubuntu is among the top-rated Linux distributions with millions of users - a mix of students, professionals, developers, and whatnot - all around the world benefitting from the same.
Although it is a desktop-friendly Linux distribution that is sort of equivalent to Windows from Microsoft, Ubuntu offers excellent development capabilities. Moreover, Ubuntu is available in 3 different variants:
- Desktop - Specialized for generic desktop usage.
- Server - Specialized for server use.
- Core - Specialized in IoT and robotics.
As you can see from above, Ubuntu Server focuses on server usage. It has gained quite a good momentum over the past few years. With the increase in the Virtual Private Server (VPS) trend, Ubuntu has become more important for server use than ever.
Before getting started with this guide on how to list users on Linux, it is imperative for you to know why exactly you might need to view the list of users on your Ubuntu Linux VPS. This is exactly what is explained in this next section.
If you're new to Ubuntu and want to understand its core features, check out our comprehensive guide on What is Ubuntu to get a solid foundation before diving into user management.
Why You Might Need to Access the User List on Linux Ubuntu VPS?
Ubuntu has become extremely popular among professionals all thanks to its efficient performance and flexibility in terms of user interaction. A Linux server not only allows multiple users to log in to the system but also enables the system administrator to control the way users interact with the system.
As a system admin, you often need to review and manage the permissions of all the users and groups that have some level of access to your VPS. By listing users and groups, you can visualize the processes (or activities) that they are running on your VPS along with their permission levels to access data.
So now that you know why you might need Linux to list all users on a Ubuntu VPS, it’s time for you to become familiar with the process that will let you do the same.
Before diving into listing all users, it's helpful to understand the fundamentals of Linux servers and how they operate. Check out our detailed guide on What is a Linux Server to get a solid foundation.
Listing Users on an Ubuntu Linux VPS
To list the users active on your VPS, you need to first establish a connection to your server. You can do this using a Secure Shell (SSH). Just keep in mind that you’ll need the PuTTy SSH client to access your VPS if you are on Windows.
On the other hand, if you are on a Mac or Linux, the built-in terminal will get the job done. After getting into your VPS system, what you need to do is simply run the following command in Ubuntu to list all users:
less /etc/passwd
After running the command, you will be able to see a list similar to the one shown below:
This list shows all the users currently active on the VPS with the first entry on the list specifying information about the root user. Each line on the list corresponds to a single user.
Let’s breakdown the information that each line represents by taking into consideration the first entry on the list i.e.:
root:x:0:0:root:/root:/bin/bash
You’ll notice that there are 7 different fields in the line that are separated from each other using: (colons). Here is what each field represents:
- root - Username
- x - Encrypted Password
- 0 - User ID
- 0 - Group ID
- root - Full Username
- /root - Home Directory of the User
- bin/bash - Shell through which the user has accessed the server.
If you examine the other entries on the list, you will observe that the second field within each entry is represented with x. It is because the password of each user is encrypted and cannot be shown here. Thus, x is used as a placeholder for the field.
Also, you should notice that the User ID and Group ID assigned to each user are unique.
- Bonus Tip - If you want to view only the name of the users, you need to run another command, which is as follows:
cut -d : -f 1 /etc/passwd
Linux list user groups on Ubuntu VPS
Apart from listing all the users, you can also get the list of groups active on your Ubuntu Linux VPS. In general, a group is a collection of users having the same level of permissions. Groups make it easier for you, as an administrator, to control users in batches.
To view all the groups active on your VPS, you simply need to run the following command on your SSH client:
less /etc/group
You will get the list of groups on your VPS, which looks something like this:
- Bonus Tip - You can also restrict the group list to display only the name of the groups by running the following command:
cut -d : -f 1 /etc/group
Getting Information About the Users Logged into the System
It is also possible for you to get information about the users that are currently logged in to the VPS system. For that, all you need to do is to run a simple command on the SSH client, which is, merely, the letter w.
If you’re looking to manage users further, check out our guide on how to add users on Ubuntu for step-by-step instructions on adding and configuring new user accounts.
w
After executing the command, you will be able to see a list of all the users currently accessing the VPS system. In the screenshot ahead, there is only a single active user (root):
There are a total of 8 columns, with each column providing a specific piece of information. Here’s the information that you’ll get:
- USER - Username.
- TTY - Terminal name of the VPS server from which the user is accessing the system.
- FROM - Hostname of the user.
- LOGIN@ - Login time of the user.
- IDLE - Idle time of the user.
- JCPU - Total time used by processes linked with the TTY.
- PCPU - Total time used by processes linked with WHAT.
- WHAT - Current process run by the user.
Difference Between System User and Normal User
Whether you are using Linux VPS to host games or using it for development purposes, there’s one important thing that you need to know:
The difference between the system user and a normal user.
-
System User
Consider the system user as the supreme user that can control and manage other users accessing the system. In other words, the system user has the authority to create and give permissions to new users, i.e. normal users.
Whenever you install Ubuntu, the OS automatically creates the system user. When you list users on your Ubuntu Linux VPS, you will notice the first user on the list as root, which is the system user by default.
-
Normal User
A normal user is one having limited privileges and system access. The permissions of a normal user are decided by the system user.
Final Words
By now, you will be able to successfully list users in Ubuntu Linux VPS. Therefore, you will be able to better manage your Linux Ubuntu Virtual Private Server by tracking user activity in real-time. If you're looking to host a website or run complex applications, buy linux vps can provide you with the power, flexibility, and security you need to meet your goals.
Want to share your experience or report something that isn’t working with your VPS Ubuntu? Feel free to do so via the dedicated comments section below. Your feedback helps us improve! Until next time!
Looking to manage users on your Linux system? Check out our guide on how to remove users in Linux for straightforward instructions.
People also read:
- How to Change the Hostname on Linux
- How to set a Static IP on Ubuntu Server
- How to reset Ubuntu Root Password
- Best Linux mail servers
- tep-by-Step Guide on How to Host a Website on Linux VPS