3 horizontal lines, burger
3 horizontal lines, burger
3 horizontal lines, burger
3 horizontal lines, burger

3 horizontal lines, burger
Remove all
LOADING ...

Content



    How to add unprivileged user/admin on Linux

    Clock
    28.02.2026
    /
    Clock
    11.03.2026
    /
    Clock
    2 minutes
    An eye
    48
    Hearts
    0
    Connected dots
    0
    Connected dots
    0
    Connected dots
    0
    Tags:
    CLI
    Bash
    Server

    About why to make an unprivileged user

    First, let's get it right: the difference between a privileged and an unprivileged user. The first one, often known as root, can read, write, create, and modify any files on the system without any restrictions. The second one, on the other hand, can also read, write, create, and modify files, but with restrictions. And without special access rights and the corresponding password, this user can't harm the system in any way.
    Despite this, backdoors still exist. There's a whole group of vulnerabilities called "Local Privilege Escalation," which allow someone to gain root's privileges. For example, incorrect system file configurations, incorrect file permissions, kernel vulnerabilities, and social engineering can lead to this.
    The reason for this is best explained with an example. When deploying your web server, for example, on Nginx, it's done under a special user—www. This user's actions and movements are limited to the site's directories.
    And if this user is compromised, the attacker will not be able, for example, to gain access to databases that are usually managed by another user.

    How to make and configure an unprivileged user

    Next, I'll show you how to create a user on Linux servers. There's little difference between creating such a user on Debian/Ubuntu and CentOS/RHEL. I'll explain all the details.
    So, to create a user (with a home directory) and set a password, you can use the following command:
    useradd -m -s /bin/bash antony passwd antony
    If you don't want the user to have their own home directory, simply remove the -m flag. You can also omit the password, but this will cause some difficulties when working with this user. Logging in as this user requires a password.
    The -s flag allows you to specify the default shell. I find for myself that bash is much more convenient and easier to deal with than sh.
    You can also change the default shell after creating the user (and not only that). This is done with the command: usermod -s /bin/bash antony
    We've added a standard user to the system; now we need to make them an administrator. This user is still not a root user, but they can change system settings and download the packages they need into the system. To make a standard user an administrator, you need to add them to special groups: sudo for Debian/Ubuntu and wheel for CentOS/RHEL.
    usermod -aG sudo antony
    The -a and -G flags are for adding the user to the sudo group while preserving the same user in any other groups they were previously a member of.
    Finally, to log in as the new user, use this command:
    su antony
    Since you're working with a Linux server, you might also be interested in learning how to completely stop using a password for logging into the server. To do this, you can create SSH keys and use them instead.

    Do not forget to share, like and leave a comment :)

    Comments

    (0)

    captcha
    Send
    LOADING ...
    It's empty now. Be the first (o゚v゚)ノ

    Other

    Similar articles


    Why and how to solve server response delay, err_http2_ping_failed error, my investigation and solution

    Clock
    29.09.2024
    /
    Clock
    11.03.2026
    An eye
    3357
    Hearts
    0
    Connected dots
    0
    Connected dots
    0
    Connected dots
    0
    In this article, I will describe in detail how I solved the problem of server response delays (err_http2_ping_failed) to client requests. I will describe the operation of the ERR_HTTP2_PING_FAILED error …

    How to Run Django Server: 4 Ways (runserver, Gunicorn, Nginx) | Complete Guide

    Clock
    17.10.2025
    /
    Clock
    11.03.2026
    An eye
    750
    Hearts
    0
    Connected dots
    0
    Connected dots
    0
    Connected dots
    0
    A complete guide on launching a Django server. Learn 4 essential methods: from the default runserver for development to using WSGI/ASGI, Gunicorn, and Nginx for a live (production) environment.

    How to generate and use a SSH keys

    Clock
    26.02.2026
    /
    Clock
    11.03.2026
    An eye
    83
    Hearts
    0
    Connected dots
    0
    Connected dots
    0
    Connected dots
    0
    In summary, this guide explains how to generate a key pair for an SSH connection to a remote server. Also, how to transfer them to the remote server and how …