You've installed Webmin, you can log in and out as root, but you don't want to do everything as root. It's better for both security and convenience if you can log into Webmin as your non-privilged Linux user. The problem: even though you've already got an existing Linux user on the server other than root, that user doesn't show in Webmin. Don't worry, this is completely normal for a new Webmin install.
Here is a tutorial for how to allow an existing Linux user to login to Webmin. These instructions were carried out with Webmin 126.96.36.199
- A Linux server with Webmin installed via the root account.
- A non-root user account on the Linux server. It doesn't matter if your non-root Linux user can SSH into the server or not, it's only important that the non-root user exists.
Most likely you've already got both those requirements if you've set up a VPS and installed Webmin. This is a pretty typical setup.
1. A Linux user and a Webmin user can be 2 different things
Before proceeding any further, it's important to know that from Webmin's point of view, a Linux user and a Webmin user may be 2 different things. A Webmin user simply means a user which has access to Webmin.
Just because Linux users exist on the server does not mean they automatically have access to Webmin.
In your initial Webmin install, root will be your only Webmin user. Your server may have other Linux users, but they are not Webmin users (yet). In fact, even on a 1 person system, many of the other Linux users you wouldn't want to be Webmin users for security reasons. Even your 1 person server will have system users that are part of a standard Linux install, such as daemon, bin, sys, and many more. They don't need to be able to log in to Webmin.
Let's move right along to exactly how to let an existing Linux user log into Webmin.
2. Log into Webmin as root, then go to Webmin > Webmin users
Assuming you have Webmin 2.0.21 or similar, after you log in as root, go to the Webmin sub-menu and then Webmin users, as shown in the image below. Beware: do NOT go to System > Users, no matter how tempting it is! Just go to Webmin > Webmin users. Your screen will look like this:
As you can see, root is the only user currently listed. This is to be expected in a new Webmin install.
3. Click on the tab "Create a new safe user"
As in the image above, click on the tab "Create a new safe user", assuming the user is to be non-privileged. This is the case for most 1 person setups where you want your Linux user to be able to upload, download and edit files in their home directory in Webmin without needing root permissions.
Your screen should now look like this.
In the username field, fill out the same username as the existing Linux user. For example, when you were first setting up your VPS, if your non-privileged Linux user is called jamesw then in the username field you would type jamesw. Don't worry, this will not erase the existing jamesw account! This is providing you followed the above instructions and did this via Webmin Users (NOT System Users).
In the password drop-down menu in the image above, you have 2 main options for authentication. I recommend using "Set to..." and in the field next to it, type in a new password for that user. Webmin will store the password encrypted. The password does not need to be the existing Linux password, in fact it's better if it's different. On the "set to" option, Webmin then uses its own authentication system. Using Webmin's authentication for logins means that if the user was to later change their Linux password, it would not affect their Webmin password. This is why it's better to use separate passwords at the beginning to avoid confusion if you're using "set to".
The alternate option for authentication would have been to use Unix authentication where Webmin uses the existing Linux authentication process. This would mean the user has the same password for Linux and Webmin. Although this sounds convenient, I don't recommend it. What if the user later changes their Webmin password from inside Webmin? Does this mean their Linux password is changed too? (I don't know).
So you can avoid confusion by using the "set to" option and separate passwords for the Linux server versus Webmin.
If you wish, on this page you can choose to specify which Webmin information the user has access to by expanding the "Available Webmin modules" above the green "Create" button. You can opt to do this later, which is what I'll show in the next step.
Then click on "Create". Your new user exists! By default, they will be in their home directory when they log in to Webmin.
4. Edit the new Webmin user to allow access to the activities they need
Your new user needs access to the tools and abilities they need, otherwise they won't be able to do or see anything when they log in except for the status screen. So, as the root user in Webmin, go to Webmin > Webmin users. You'll now see your new user appear on the user list.
To edit the new user, do NOT click on the checkbox next to their name, simply click on the name itself. Then on the resultant Edit Webmin User screen, expand out the bottom section "Available Webmin Modules" as shown in the image below.
Then check the boxes for the things you'd like your user to be able to do. At minimum, for your typical 1 person VPS setup, these would typically be:
- Change passwords
- System and Server Status
- File Manager
- Upload and Download
Obviously it's up to you to select what you want depending on your use case, what your users need to do and whether or not you trust them.
The user will be default wind up in their home directory when they log in, and (provided you have allowed access to file manager) they will be able to see all of their existing files.
It's easy to set up Webmin to allow an existing Linux user to log into Webmin as described above. The user's existing files are viewable from there.
Now that you've accomplished that, you might find you have other tasks to handle for your server setup. I recommend using a productivity program on your desktop computer to keep track of your to-do's and make your workflow go smoothly. Here is our list of best open source productivity tools.