pctechguide.com

  • Home
  • Guides
  • Tutorials
  • Articles
  • Reviews
  • Glossary
  • Contact

Using Sudo for Super User Access to Root Privileges in Linux

The Linux super user, or root user, is a special user that has tremendous power, with the ability to access and modify all files on the operating system. This is necessary at times, but there is a potential for accidental errors to cause a great deal of destruction, so you have to be careful. (Like Spiderman says, with great power comes great responsibility.) Fot the times when the super user’s power is necessary, we’ll look at safer ways to be the super user on your Linux dedicated server.

Super User and Sudo

A really important feature of Linux is privileges. It’s part of the security, and controls which users can access, manipulate or even be aware of what files. Logged in with the user account we’ve created will allow safe usage of the operating system, but there are times when the privileges of the root, or super user are required.

There are two ways to access super user privileges. The first is with the su command.

$ su –

If you enter this command, and note the hyphen, then you will be prompted for the root user’s password. Enter it correctly, and you will be logged in as the super user. You can then perform what tasks you need to, but with care! When you’ve finished, log out immediately using the exit command.

The second way to get super user privileges is to use sudo. This is a method by which a regular user can gain a temporary privilege boost. It takes a little setting up, but once done it is probably safer than the su command method.

First, log in to your server. Then, log in as root using the su command. Then, enter the following.

$ visudo

This will open up a text file that contains information for sudo. A little way down the file you’ll see the following text.

# User privilege specification

root ALL=(ALL) ALL

You need to add yourself to the file in order to get your privileges. To do this, you need to do a little editing. Use the arrow keys to move the cursor to this line, then press i on the keyboard. You’re now editing the file, so enter the following line:

YourUserName ALL=(ALL) ALL

Of course substitute your user name for YourUserName, then press escape, and type ZZ (capital Z twice). This will save the file, and that’s it. If you’ve done it right, you can now use sudo. To test this, log out as the root user (type exit, hit return), then try the following.

$ ls /root

You should receive an error message telling you that permission is denied. So, try it with sudo.

$ sudo ls /root

Now you will be asked for a password. Enter your own password at this point (not the root password) and hey presto, you’ll be presented with a listing of the root user’s directory. So, any time that you wish to do something that requires root user privileges, remember that you can use the sudo command, saving you from logging in as the root user.

Logging out

To log out of your ssh session, and so your server, at any time, type:

$ exit

If you are logged in as the super user having used the su command, remember that you may need to type this twice.


Now we know how to log in and out we want to do something constructive with the server, but before we get to the commands we should take a look at the Linux directory structure.

  • Advantage to Shared Web Hosting
  • Shared Hosting Issues – Shared Bandwidth and Server Resources
  • The Ins and Outs of Dedicated Web Hosting
  • When To Move To A Dedicated Server
  • Choosing a Dedicated Server for your Website
  • Managing and Operating a Dedicated Server Over the Internet Using Online Control Panels
  • Accessing the Linux Operating System on Dedicated Servers with PuTTY or SSH
  • How to Create a Secure Password
  • Using Sudo for Super User Access to Root Privileges in Linux
  • The Linux Directory Structure
  • Linux Commands for Navigating and Viewing Directories
  • Creating, Moving, Renaming and Copying Files and Directories in Linux
  • Find, View and Delete Files and Directories Using Linux Commands
  • Using vi to Edit Text Files on A Linux Dedicated Server

Share this:

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

Related

Filed Under: Moving from Shared to Dedicated Web Hosting Tagged With: linux and super users, super user access, using sudo in linux

Latest Articles

The Growing Impact of VPN on Rethinking Data Privacy

Online privacy is a growing concern in the United States and abroad. A 2014 poll showed that 61% of Americans wanted some variation of the European "Right to Be Forgotten" law. People are even more concerned about the people that have control over their data. Polls from Pew Research showed that … [Read More...]

Web Development Guide 3

Very often a website can be built in-house, but the implications of this can easily be overlooked. Even for a simple website of maybe a page or two, it shouldn't be treated as something which can simply be thrown together haphazardly, and then forgotten and left to gather virtual dust. If … [Read More...]

WCDMA

WCDMA Definition: Wideband Code Division Multiple Access: a 3G wideband radio technique which makes highly efficient use of radio spectrum and is capable of supporting data rates of up to 2 Mbit/s, sufficient to allow simultaneous access to several voice, video and data services at … [Read More...]

Comments

  1. Misssypi says

    February 26, 2012 at 8:51 pm

    a question about
    sudo su
    does this command enable root without asking for the account password ?
    therefore is it safer to enable root just to set a password so that if someone who knows your account password cannot perform sudo commands ?
    or …if the ‘sudo su’ command doesnt ask for a password does it even make a difference ?

2021 PC Hardware Releases to Bolster Your Gaming

If you are a PC gamer, then chances are you are looking to upgrade your kit over the coming year. However, a lot of money can go into building the … [Read More...]

New Transfer Feature in Dropbox Enable Sharing files with Third Parties

Dropbox has been a popular P2P sharing platform for many years. They don't announce new features as often as other applications, since they have a … [Read More...]

Ransomware Operators Find Data Theft Profitable

How valuable is your data? That’s not a question that organizations or individuals have to ask themselves all that often. You might know the market … [Read More...]

Engineers Encounter the Quantum Challenge with Computers Running a Hundred Million Times Faster

Quantum computers have been a subject of discussion for many years. They have probably been something that philosophers and technology pundits have … [Read More...]

Transferring Image Files from Your Cell Phone Without Cables or Email

You don't have a cable available to transfer the photos from your cell phone to your computer? You don't feel comfortable sending them through your … [Read More...]

Why Drupal Accessibility is Vital for Your Website

Drupal may not be as popular as WordPress, but it is still used in over 1 million websites. The Internet might be more conducive to our needs if more … [Read More...]

Guides

  • Computer Communications
  • Mobile Computing
  • PC Components
  • PC Data Storage
  • PC Input-Output
  • PC Multimedia
  • Processors (CPUs)

Recent Posts

CDR-RW Digital Audio Media

Digital Audio for Consumers is a term used in connection with CD recorders that form a part of a home audio stereo system, connecting to … [Read More...]

OSD Data Storage Technology

Optical Super Density (OSD) technology's design goals were to develop a high capacity (40GB or more) removable MO drive … [Read More...]

Stellar Outlook PST Repair Review

[starreviewmulti id=3 tpl=20] PROS: Stellar Outlook PST Repair software simply works. It's in our opinion the best PST file recovery program out … [Read More...]

[footer_backtotop]

Copyright © 2021 About | Privacy | Contact Information | Wrtie For Us | Disclaimer | Copyright License | Authors