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

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

Latest Articles

Why Did No One Tell Drivers About This New Rule?

Do not pay your next car insurance bill until you read this… May - (2015): Your Current car insurance company doesn't want you to know this but as someone who loves to save money and someone who loves to share what they learn, I want you to know. The simple truth is car insurance rates are … [Read More...]

LEP Flat Panels

Polymers are chemical substances that consist of large molecules that are, themselves, made from many smaller and simpler molecules: proteins and DNA are examples of naturally occurring polymers; many others, such as nylon, are artificially … [Read More...]

9 More Great Microsoft Word Hacks to Boost Productivity

We mentioned a few great Microsoft Word hacks in our last post. We wanted to follow up and share some more that can help improve productivity. Continue where you were Microsoft Word remembers where you left off when viewing and editing a document, and you can easily return to that place by … [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 ?

Why Cross-Chain Trading Is the Future of Crypto Investing?

The rapid growth and evolution of the cryptocurrency market have opened up exciting opportunities for investors. Within this dynamic landscape, … [Read More...]

Revolutionize Your Internet Experience with Orbi 960 – The Ultimate WiFi System

In a world where seamless connectivity is essential, slow and unreliable internet connections are a major problem. Whether you are running a business, … [Read More...]

Do You Need a VPN When Trading Cryptocurrency?

There’s no doubt that the biggest global industries in 2023 are tech-driven, while there remains a significant crossover between many of these … [Read More...]

Goodbye Bitcoin: the 3 alternative cryptocurrencies that have great upside potential, according to experts

Bitcoin has been a very lucrative investment for people that got into it early. One report from The Motley Fool pointed out that $10 of bitcoin … [Read More...]

Self-driving cars face their Achilles’ heel and may be targets of hackers

The market for self-driving cars is booming. Customers spent $22.22 billion on these autonomous vehicles in 2021 and they will likely spend more in … [Read More...]

How to avoid scams with bitcoin and other cryptocurrencies

Cryptocurrencies got a bad reputation when scams multiplied like ants on a piece of cake. Even today many people associate bitcoin and other … [Read More...]

Guides

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

Recent Posts

Eliminating Common WordPress Vulnerabilities to DDoS Attacks

Distributed Denial of Service (DDoS) attacks are serious threats that every website manager must be prepared for. Unfortunately, some of the most … [Read More...]

Defragmenting the Hard Drive with Windows XP

In older file system architectures, if a file could not be stored contiguously, it could not be saved to the disk. Newer architectures … [Read More...]

Remove Security Tool

Recommended Antivirus Software: Spyware Doctor with Antivirus Recommended Remote Computer Repair Company: http://www.pcninja.com Security Tool is a … [Read More...]

[footer_backtotop]

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