Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-15-2005, 02:23 PM   #1
Registered: Nov 2004
Distribution: CentOS-4
Posts: 142

Rep: Reputation: 15

ok - so i would like to avoid logging in as root as much as possible, but about 80% of the time if I log under some other account, I need root privlages. SU - just doesn't seem to be enough for me.

So - does anyone have any tips they can share on how to set-up an account that has the power of root, but doesn't let a person do anything 'dangerous'?

So I guess I want to be as close as root as possible without being root.
Old 03-15-2005, 02:31 PM   #2
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128

Well, having the power of root implies having the danger of root. A suitable alternative/middleground to the use of the root account is the sudo package. Sudo uses a file (/etc/sudoers) that contains a list of users, groups, and commands. Through this file, you could, for example, give a user full power of root, but require them to re-enter their password. Or, with the (NOPASSWD) option, without re-entering the password. Or you could limit a user to using, say, 'mount'. Or 'ifconfig'. Beware allowing sudo access to an editor: they could edit the sudoers file.

All the user has to do is prefix commands they wish to execute with elevated privileges with the 'sudo ' command. Under gentoo, I can allow a user to install software by giving them sudo access to 'emerge'. The user could then run 'sudo emerge k3b' to install k3b on the system.

Hope this helps!
Old 03-15-2005, 02:44 PM   #3
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Of course, if you run
su -
you get to be root totally, then type exit to log out of root and be back at your own account. What's wrong with "su", does everything I need it to.
Old 03-15-2005, 03:05 PM   #4
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I originally used sudo on a server where we wanted to give many users partially elevated privileges. Hence, the ideal situation of sudo. It also keeps me from "forgetting" that I'm logged in as root after I su.

I use su for longer tasks, but sudo if I just need to do one or two things. And, if sudo is configured to allow you to do ANYTHING without a password, you can do: 'sudo su -' to save some typing. or alias rootme='sudo su -'. 6 characters to root!

In any case, I think sudo vs su is a lot like KDE vs Gnome: they both work, and different people swear by them.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL3 Mounting USB after reboot and between reboots: root and non-root users Luis Nunes Linux - Hardware 0 07-20-2005 08:32 AM
IntelliMouse thumb buttons work as root, broken as non-root user, wheel works always digital vortex Linux - Hardware 7 03-02-2004 04:14 PM
root files: create as root:root or root:wheel? pcass Linux - Security 1 02-07-2004 04:14 PM
cant resize root thru rescue, auto mounts root dir absolutal Linux - Newbie 0 06-18-2003 03:06 PM
Why does kppp.desktop require root userid for non-root user? Linux - Networking 4 08-27-2001 09:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration