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
  • 8 Users Found This Useful
Was this answer helpful?

Related Articles

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

htaccess RewriteRule Examples

Here are some useful mod_rewrite RewriteRule redirect examples that you can use in your .htaccess...

Using htaccess File to Block IPs

If your webserver is Apache, you may block access to your website from specific IP addresses...

Enable Browser Caching with htaccess File

Enable browser caching to reduce website loading times, by taking advantage of caching of...