Skip to main content
Home
Techies Briefcase
~ by Hari Venu

Main navigation

  • Home
  • About me
  • Photos
  • My Bookmarks

Breadcrumb

  1. Home
  2. How To Create a New User With Root Privileges In Linux

How to Create a New User with Root Privileges in Linux

By hari, 21 February, 2025

In Linux, managing user accounts and their permissions is crucial for maintaining system security and organization. Sometimes, you may need to create a new user and grant them root privileges to perform administrative tasks. This guide walks you through the steps to create a new user with root (sudo) access in Linux.

Step 1: Create a New User

To add a new user, use the following command:

sudo adduser newusername

Replace newusername with the actual username you want to create. You will be prompted to set a password and enter optional details like full name and contact information.

Step 2: Grant Sudo Privileges

Once the user is created, you need to grant them root privileges by adding them to the sudo group.

sudo usermod -aG sudo newusername

For CentOS, RHEL, and Fedora, use:

sudo usermod -aG wheel newusername

(The wheel group in these distributions has sudo privileges.)

Step 3: Verify the New User’s Access

Switch to the newly created user:

su - newusername

Then, check if the user has sudo privileges:

sudo whoami

If the output is root, the user has been granted sudo access successfully.

Step 4: (Optional) Enable Passwordless Sudo

If you want the user to run sudo commands without being prompted for a password, edit the sudoers file:

sudo visudo

Find the following line:

%sudo   ALL=(ALL:ALL) ALL

Modify it to:

%sudo   ALL=(ALL:ALL) NOPASSWD:ALL

Save and exit the file.

Conclusion

By following these steps, you can create a new Linux user with root privileges, ensuring that they can execute administrative tasks securely. Always be cautious while granting root access to users, as it allows them to make system-wide changes.

If you have any questions or need further assistance, drop them in the comments below!

Tags

  • Linux
 

Topics

  • Composer
  • Commad Line Tools
  • JavaScript
  • Drupal
  • Solar Panel
  • Permission
  • Libraries
  • MySQL
  • Commad Line
  • RSA
  • VSCode
  • Windows
  • Entity Query API
  • Ubuntu
  • Bash Script
  • Drush
  • Bower
  • Errors
  • Workflow
  • File API
  • Docker
  • Linux
  • Lando
  • Articles
  • Views
  • Nginx
  • Twig
  • Multilingual
  • OOPs
  • Coder
  • Solar Power
  • PHP
  • Field API
  • Android
  • Cache
  • Webform
  • jQuery
  • phpcbf
  • Ajax API
  • Distribution
  • Drupal Behavior
  • Learning
  • kali
  • professional development
  • Neuron AI
  • Jellyfin
  • SSH
  • URL
  • Macbook
  • WSL2
  • Drupal AI
  • NPM
  • Git
  • Form API
  • phpcs
  • Drupal Console
  • Codesniffer
  • Moderation
  • PHPSeclib
  • Taxonomy
  • Mac OS
RSS Feed

Who am I !!!

Hari Venu V
harivenu.v1992@gmail.com
Mobile : +91 9895164181
Whatsapp : +91 9895164181
Linkedin
Drupal.org
Github

Document
Resume.pdf (114.38 KB)

Work !!!

Fulltime Developer @ QED42
hari.venu@qed42.com
Linkedin

Powered by Drupal & Maintained by Hari