udroid docs
  • 🛸udroid-landing
    • 🐧udroid
      • ⚠️Disclaimer
    • 📖Installation & Usage
    • 🖥️Display
      • setting up termux-x11
    • 👩🏻‍🔧Tips & Tricks
      • 🦊Fixing Firefox Sound
      • 📇External Sdcard Access
      • 🔊Audio
    • 💳Credits
      • 💀The End
  • 🥷using udroid
    • 🔓Non-root Users
  • SUITES
    • Ubuntu 25.04
    • Ubuntu 24.10
    • Ubuntu 24.04 LTS
    • Ubuntu 22.04 LTS
    • Ubuntu 20.04 LTS
    • EOL suites
      • Ubuntu 23.10
      • Ubuntu 23.04
      • Ubuntu 22.10
      • Ubuntu 21.10
      • Ubuntu 21.04
Powered by GitBook
On this page
  • Creating non-root user
  • useradd
  • Adding SUDO rules for new user

Was this helpful?

Edit on GitHub
  1. using udroid

Non-root Users

creating and managing non-root users

here is a step by step guide to creating a non-root user in any Linux

prerequisite

  • A working Linux with useradd & openssl installed

  • a terminal to access Linux

Creating non-root user

there are two ways to create a non-root user ( thanks to tools in Linux ) one shows a prompt that asks all the details required & sets up everything itself and the other is more like linuxy way ( we are doing the second way cause it's good for one-liners )

useradd

useradd is a low level utility for adding users

  • make sure to install OpenSSL with apt install -y openssl

for this guide let's say the username you want to create is ubuntu and the password for it is foxy1. add username and password to a variable to make the process easier

username="ubuntu"
password="foxy1"

then copy-paste the below command in your terminal

useradd -m \
    -p "$(openssl passwd -1 ${password})" \
    -G sudo \
    -d /home/${username} \
    -k /etc/skel \
    -s /bin/bash \
    $username

Now you successfully created a non-root user

Adding SUDO rules for new user

you may observe that the traditional way for adding a user to the sudo group won't work cause sudo daemon service can't start in proot. but adding rules to sudoers.d will do the job as a workaround

to do this add username to variable

username="ubuntu"

then add sudo rules with this command

echo $username ALL=\(root\) ALL > /etc/sudoers.d/$username
chmod 0440 /etc/sudoers.d/$username

Now you see sudo working when you login to you new non-root user

PreviousThe EndNextUbuntu 25.04

Last updated 1 year ago

Was this helpful?

🥷
🔓