how to use the sudo/su command

in my previous project to set up CUPS on a x86 Debian PC, i had to learn something about the su command, since the OS doesn’t come with the command bundled. i was trying to explain this within that tutorial, but realized that it’s enough to break out into it’s own section.

so, a bit of background. and take all this info with a grain of salt, these are just musings from my experience, and i probably dont have the full picture of what’s going on. so, the root user always exists on Linux, with full admin privileges. but they try to protect the system by not having that account in use except when necessary. so typically you create a standard user, and then just “elevate” when necessary. that elevation is done through the sudo command.


  1. install package
  2. add user to sudo group
  3. common options

to install the package, start by logging in as root, then run this command:

step 1: install package

apt install sudo

that’s it.

step 2: add user to group

sudo usermod -aG sudo <username>

for my project, i needed to add the secondary user to the printer admin group, which is the same, except for changing the group name:

sudo usermod -aG lpadmin <username>

step 3: common options (and various info)

the ID command

you can check that this was successful by running the “id” command. if you type


it will tell you who is currently logged in.

if you type id and a valid user account, it will list all the groups they’re a member of. for example:

id steven

you can look for the ‘sudo’ and ‘lpadmin’ after you’ve done those commands.

if you’re having trouble sorting through that whole list, you can also find it through a cat and grep command:

cat grep

this is because the groups list is within that etc location.

the SU command

you can also raise the secondary user’s privileges through the use of the SU command:

su -s

references/further reading

Leave a Reply

Your email address will not be published. Required fields are marked *