Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > Your Distro > Ubuntu Help
Reload this Page Using sudo in place of root login in Ubuntu
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Ubuntu Help Discussion and help about Ubuntu, Kubuntu, Xubuntu, and all the Ubuntu family

Closed Thread
 
Thread Tools Display Modes
Old 11-05-2007   #1 (permalink)
bigtomrodney
Bigtomrodinator
 
bigtomrodney's Avatar
 
Join Date: Nov 2004
Location: Sunny South-East of Ireland
Posts: 4,790
Exclamation Using sudo in place of root login in Ubuntu

root / sudo
If you are reading this you are likely aware that the administrator on Linux/Unix systems is referred to as root. The root account is the account on which all system processes run and should be the only account that can write to the main filesystem.

Because most of us started our computing lives out using Microsoft Windows there has always been a notion that it is better to be the administrator of the system. Unfortunately this is one of the major causes of insecurity in computing and opens up your system to instability. As most Linux users will tell you, only log in as root to perform maintenance on your system and never log in to a graphical or desktop session using root.

Ubuntu takes this one step further. Rather than asking users not to login as root, they have locked the root account and default to using sudo. As a side effect users have /sbin, /usr/sbin and /usr/local/sbin as part of their $PATH environmental variable, meaning they can see commands that users can not normally see.

What is sudo?
It is a tool to allow you to execute a command as root, without logging in as root. Its name is derived from a related command su "do". su is the command to switch user and is most frequently used to run commands as root. So in essence, sudo is 'switch user do <command>.

It provides several key benefits;
  • It logs all commands run using it
  • It logs failed attempts to authenticate using it
  • It can be restricted in a much more detailed way than simply using root, i.e. per user permissions
  • It can be used with the user's login password rather than distributing the root password
The latter is the case with Ubuntu so that users are prevented from logging in permanently as root but can temporarily elevate themselves to root to run the required system command. Ubuntu is configured to allow members of the admin group have access to commands via sudo. Anyone else attempting to run a command in this manner will have their attempt logged and mailed to the system administrator(s).

How is it used?
When running certain commands in a terminal you will notice that they will either not work or will return no information. Try running
Code:
fdisk -l
The above command will have run as your own regular user and should not have returned a value. Now try running it with sudo, to run it with root privilege
Code:
sudo fdisk -l
This time you should be prompted for your password and on entering it you will see a listing of all of your hard disk partitions, something only possible with root privilege.

What about graphical applications?
Although it isn't a great idea to run any old application as root, there are some that need to such as package managers and system configuration tools. Synaptic Package Manager for example. You can run the command 'synaptic' but you will receive errors about starting without administrative privileges. But if you were to prefix this with gksu (for Gnome) or kdesu (for KDE) you will first be prompted for your root password and then the application would run correctly.

So there you have it. That little prefix to your commands lets you run just what needs to be run as root and keeps your system secure and stable. And even for distributions that do not require the use of sudo, it can't be a bad habit to get into

Further reading:
sudo
Wikipedia entry on sudo
Ubuntu article on sudo

Last edited by bigtomrodney : 11-09-2007 at 07:55 PM.
bigtomrodney is online now  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing a Windows share via Apache on FC5 aschoessler Servers 10 07-13-2007 05:17 PM
Need help on apache.. Magice Redhat / Fedora Linux Help 23 07-07-2005 10:21 PM
Hidden Users on Server? methodical Linux Newbie 11 07-28-2003 09:49 PM
sendmail behavior k007 Servers 0 07-09-2003 12:53 AM


All times are GMT. The time now is 10:07 PM.

Powered by vBulletin 3.6.8 ©2000 - 2007, content relevant URLs by vBSEO, Property of Core Root.

Content Relevant URLs by vBSEO 3.0.0