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 young ladies. 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

With no cakes having to go out the door for @thehelderbergcakecompany on Sunday, Chantelle, the girls, and I enjoyed a lazy afternoon of nibbling on pizza, sipping coffee, and rolling on the grass lawn at Bluebird Cafe, situated next to the old Mountain Breeze farm stall on the R44 between Stellenbosch and Somerset West. #pizza #sundaylunch #familytime #bluebirdcafe #mountainbreeze #r44 #stellenbosch #southafrica #anexploringsouthafrican
Stellenbosch Flying Club wasn't allowing non members to join them for brunch, so instead, we hopped across the road for a wonderfully relaxed meal at Bluebird Cafe, a relatively new venture next to the old Mountain Breeze farm stall. #lunch #bluebirdcafe #mountainbreeze #r44 #stellenbosch #southafrica #anexploringsouthafrican
You don't have to walk down this path at the Steenbras Water Treatment Plant lookout point, but I was curious enough to do it. #lookoutpoint #steenbraslookoutpoint #helderbergmountain #mountain #gordonsbay #helderberg #southafrica #anexploringsouthafrican
Looking out across Gordon's Bay. The sky was a little hazy today, so not great for photos unfortunately. #lookoutpoint #steenbraslookoutpoint #helderbergmountain #mountain #gordonsbay #helderberg #southafrica #anexploringsouthafrican
Looking up towards the Steenbras Water Treatment Plant on the upper slopes of the Helderberg mountain. #lookoutpoint #steenbraslookoutpoint #helderbergmountain #mountain #gordonsbay #helderberg #southafrica #anexploringsouthafrican
There's a dog at the top of those stairs watching a very heavy man huff and puff his way up some rather steep steps. #lookoutpoint #steenbraslookoutpoint #helderbergmountain #mountain #gordonsbay #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