How do I create a named Linux account instead of sharing a root login?
A named account gives each administrator an identifiable login and allows privileges to be assigned separately. Account creation and administrator access are distinct decisions. Create the account using the distribution’s supported tools, then configure its approved authentication method and only the required sudo rights.
Before you start
- Existing authorised administrative access and an approved account name.
Instructions
1. Check whether the account already exists
A pre-existing account may belong to an application or another person. Do not repurpose it without understanding its ownership.
getent passwd adminuserIf this returns an entry, inspect that existing account instead of running another creation command.
2. Use the appropriate distribution command
On Debian or Ubuntu, adduser provides an interactive account setup. On a RHEL-family system, useradd can create a home directory and select the approved shell. Run only the command for your distribution.
sudo adduser adminuserDebian/Ubuntu example: follow prompts without placing a password in a shell command.
sudo useradd -m -s /bin/bash adminuserRHEL-family example: this creates the account and home; it does not automatically enable password or SSH-key login.
Check the result
- getent passwd adminuser and id adminuser show the intended identity and home. Test approved authentication in a separate session before changing any existing administrator access.
Troubleshooting
- The chosen shell does not exist
- Check the available shells and select one supported by that server’s policy.
- The account cannot use sudo
- Sudo access is a separate policy decision; do not grant unrestricted access merely to resolve login setup.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
