How to Use Sudo


This article provides a guide to using a Sudo user on CentOS server.

From the command line, login as root user.

Switch to the sudo user.

# su - username

To use sudo, simply prefix the command with sudo and a space.

# sudo [COMMAND]

For example, to list the contents of the /root directory you would use:

# sudo ls -l /root

The first time you use sudo from this account, you will see the following banner message and you will be prompted to enter the password for the user account.

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for username:

READ ALSO: How to Create Sudo User on CentOS

  • sudo
  • 6 Users Found This Useful
Was this answer helpful?

Related Articles

View Server PHP Environment with phpinfo.php

The phpinfo() function outputs a huge amount of information about the system you're using, such...

How to Change Root Password Using SSH

This article explains the method of changing the root password on a Linux Server using SSH....

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

Set Server Time Zones with Timedatectl

This article provides a guide to setting the server time and server time zone settings using...

Update CentOS Server Packages with Yum

This guide provides step-by-step tutorial for updating a CentOS server's core packages using the...