LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-10-2012, 03:14 AM   #31
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761

Quote:
Originally Posted by MJ12 View Post
Ah thanks. I don't really have a problem using su most of the time, it's just that I'd prefer to be able to just sudo installpkg instead of logging in as super user just to install a single package.
Why? It is the same number of key presses.

Quote:
Originally Posted by ruario View Post
Consider if I wanted to run the fake command 'example' once as a root user. Here is what I would actually have to type (where $password is my actual password).

Using su:
su[Enter]$password[Enter]example[Enter][Ctrl]+d
(Note: That is '[Ctrl]' and 'd' together to exit the root session, you obviously aren't typing the '+' character)

Using sudo:
sudo[space]example[Enter]$password[Enter]

Ignoring the characters needed that are the same in both cases (i.e. 'example' followed by [Enter] and your password followed by [Enter]), you have to type 5 key presses to execute a single command as root via 'su' (s u [Enter] [Ctrl] d) and 5 key presses to execute a single command as root via 'sudo' (s u d o [space]). Or to put it another way, you save nothing using sudo.

If however you wanted to type two or more commands as root, you immediately start saving on the key presses by using 'su' instead of 'sudo'. Yes the second 'sudo' command does not require a password but as long as you have not closed your root session yet (i.e. no Ctrl+d) you don't have to type your password again with 'su' either and you save having to write 'sudo' for every single line.

Indeed the other nice thing with using 'su' is that you can just open a root terminal for all your admin needs and you decide if and when you should close it, rather than relying on preconfigured time-out periods with 'sudo'.
 
Old 08-10-2012, 11:24 AM   #32
mrascii
Member
 
Registered: Jun 2012
Location: on the Net
Distribution: Slackware
Posts: 100

Rep: Reputation: Disabled
While there is little advantage to using sudo on a single-user machine where you are also root. In a corporate environment where there is more that one administrator using sudo lets you delegate root privileges in a very granular way. For example, you can give certain users the privilege to just install software but nothing more or give all root privileges for a limited time without giving them the root password. Using sudo also logs who ran the command and when it was run. Important since you might need an audit trail for compliance reasons.

DNA
AKA mrascii

Last edited by mrascii; 08-10-2012 at 11:27 AM. Reason: Added link to XKCD cartoon.
 
1 members found this post helpful.
Old 08-10-2012, 01:16 PM   #33
wigry
Member
 
Registered: Jul 2004
Distribution: slackware
Posts: 225

Rep: Reputation: 53
I administer one coprorate server where I don't have root privileges - only permission to sudo to certain user and nothing else (not even permission to sudo to root). I even don't know the password for that user I sudo to. The most interesting thing however is that certain actions still require root user which requires double sudo (the user I sudo to has a permission to sudo root):

sudo -u liferay -s sudo /etc/init.d/httpd restart

The service restart will be executed as a root user.

Last edited by wigry; 08-10-2012 at 01:19 PM.
 
Old 08-12-2012, 02:25 PM   #34
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
Quote:
Originally Posted by mrascii View Post
While there is little advantage to using sudo on a single-user machine where you are also root. In a corporate environment where there is more that one administrator using sudo lets you delegate root privileges in a very granular way. For example, you can give certain users the privilege to just install software but nothing more or give all root privileges for a limited time without giving them the root password. Using sudo also logs who ran the command and when it was run. Important since you might need an audit trail for compliance reasons.
Indeed, I entirely agree and have said almost the same thing in the past myself.

Quote:
Originally Posted by ruario View Post
The thing about sudo is that it works best when you have multiple admins on the same machine or want to grant access to individual commands to specific users. However for a personal machine it is pretty much pointless IMHO and for that reason I never understood why Ubuntu pushes it so hard given their primary target market.
I think it is a shame however that many users come to Slackware and think that they have to setup sudo to efficiently get work done, when in most cases su would suit them just as well and needs no configuration.

Regarding configuration, this might be useful to the OP if he really must have sudo for some reason.

Quote:
Originally Posted by ruario View Post
If you are going to use sudo with slack you should add /usr/local/sbin /usr/sbin and /sbin to the path of your regular user as it will make life much easier. Additionally put the command 'complete -cf sudo' somewhere appropriate like your ~/.bashrc if you want command completion. Though before you do all that reconsider the advice from schmatzler and alekow regarding just using su.

Last edited by ruario; 08-12-2012 at 02:34 PM. Reason: added more information on configuring sudo
 
  


Reply


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
Damn Small Linux questions rasidrasid Linux - Software 2 01-25-2012 08:44 AM
small questions sskraju Linux - Newbie 4 11-27-2009 10:17 AM
A few small questions Gortex Linux - Server 2 06-28-2007 03:12 AM
A couple of small questions Napalm Llama Linux - Software 6 06-06-2005 10:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:58 AM.

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