An Exploring South African

Things to do in Cape Town, the Helderberg, and the Cape Winelands

Menu

Skip to content
  • About
  • Explore

How to Add another Sudo User Account to an Ubuntu Server Tips, Tricks and Tutorials 25 AUG 2013

ubuntu-10-logoAdding a new sudo super powered user account to your Ubuntu Server is pretty simple, and more as a note to myself than anything else, here are the steps to do it.

[IMPORTANT: This has the potential to seriously damage your system if it goes wrong – mucking up the sudo command had grave consequences for any linux distro. Try it out in a test environment first if you can!]

First, add the new user account through the use of the useradd command. Note the added switches which create the user’s home directory in the specified location.

sudo useradd -d /home/newuseraccount -m newuseraccount

With the user created, next set his password using:

sudo passwd newuseraccount

(I like bash as my default shell, so you can follow these steps to do this if needed).

Now the fun part. While we can make use of the visudo command to directly edit the sudoers file (in the past this was the only way to do it), nowadays it is advised to rather make custom changes in an extra file, basically meaning that you can now easily upgrade your system without losing all of your carefully crafted user accounts. To do this, create a file in the /etc/sudoers.d directory and edit it.

sudo touch /etc/sudoers.d/sudo-custom
sudo chmod 0440 /etc/sudoers.d/sudo-custom
sudo nano /etc/sudoers.d/sudo-custom

Append the following line to add your new user account to the list of sudo accounts:

newuseraccount ALL=(ALL:ALL) ALL

Note we’ve gone and created a really powerful sudo account with the declaration above. You might want to temper it a bit by reading up on the various options available to you.

Done.

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

Sunday 25/08/2013Tips, Tricks and Tutorialsadd user, adduser, create user, sudo, sudoers.d, ubuntu, ubuntu server, user account, useraddCraig Lotter

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more. View all posts by Craig Lotter →

Post navigation

← How to quickly install the LAMP Stack on an Ubuntu Server Ubuntu Server: How to Change the default SSH Port from 22 →

An Exploring South African

Curiosity, travel, and discovering new places. Craig Lotter's An Exploring South African is primarily a South African travel blog of things to do in and around Cape Town, the Helderberg, and the Cape Winelands.

Craig Lötter

A South African software developer at Touchwork, Craig Lotter is a husband to a cake baker, father to two young girls, and someone who is constantly looking for new places to explore. He is also not that bad of a writer either.

   

Instagram

View from the dry and dusty (thanks Summer) hill that Durbanville Hills finds itself perched upon. #tablemountain #thetangram #tangram #tangramrestaurant #wineestate #durbanvillehills #durbanvillehillswine #durbanville #southafrica #anexploringsouthafrican
Pork Belly starter, Springbok Venison main, and of course a lot of wonderful Durbanville Hills wine. Great lunch out at The Tangram at Durbanville Hills wine estate. #venison #springbok #thetangram #tangram #tangramrestaurant #wineestate #durbanvillehills #durbanvillehillswine #durbanville #southafrica #anexploringsouthafrican
Work lunch engagement out at The Tangram @ Durbanville Hills wine estate. Definitely worth the drive! #thetangram #tangram #tangramrestaurant #wineestate #durbanvillehills #durbanvillehillswine #durbanville #southafrica #anexploringsouthafrican
Blue skies and softserve ice cream on the wall. #promenade #strandpromenade #beachwalk #beach #strandbeach #strand #helderberg #southafrica #anexploringsouthafrican
Beach soccer. #beachsoccer #soccer #beachwalk #beach #strandbeach #strand #helderberg #southafrica #anexploringsouthafrican
My tracks in the sand are more like footplods than footprints 😅 #beachwalk #sanddunes #beach #strandbeach #strand #helderberg #southafrica #anexploringsouthafrican

Subscribe via Email

Enter your email address to subscribe to this blog and receive notifications of new content via email.

Copyright © 2007-2021 Craig Lotter | Rugged Rock Studio | Proudly powered by WordPress