LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   What do you use sudo for (https://www.linuxquestions.org/questions/slackware-14/what-do-you-use-sudo-for-509167/)

dosnlinux 12-10-2006 03:05 PM

What do you use sudo for
 
I'm tired of using su -c for everything, and want to use sudo. The only problem is that whenever I go to configure sudo my mind draws a blank on what to add.:study:

So what are some of the things you guys use sudo for?:scratch:

Boby 12-10-2006 03:20 PM

I use sudo because I'm also tired of using "su -" most of the time.
Don't know how you system is set up actually I mean what you're using it for. Mine is just for personal use, not a server so I just set sudo for everything and with no password :)

Code:

chmod +w /etc/sudoers
echo 'yourloginname ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
chmod -w /etc/sudoers
exit

(Sometimes you don't have to chmod the /etc/sudoers file, but I've seen posts where people cannot write to the file because it's read-only)

If you want to use sudo just for some commands, I actually think you need to spend some time and whenever you need a new command add it to the list until it meets your needs.

Boby

drkstr 12-10-2006 04:28 PM

I posted a reply to a similar question a little bit ago that outlined my thought process for figuring out how to sudo correctly, maybe it will be of some use:

http://www.linuxquestions.org/questi...97#post2536497

best regards,
...drkstr

zetabill 12-10-2006 04:52 PM

I use sudo on my laptop and I do it the laziest way possible. When I make my user for the machine I add it to the wheel group and in visudo I just uncomment the sudo for wheel option with nopasswd. Takes all of 2 seconds and I can sudo to my heart's content with whatever I wish to do. For this reason I also add, via .bash_profile for my user, /sbin/ and /usr/sbin/ to my PATH.

This is only for my user, though. Should I add any other users to this machine they would not be in the wheel group nor would they get a beefy PATH. I would probably do something similar to drkstr's reference where only certain commands would be given sudo privileges and then aliased for convenience.

On my machine that I use as a server, sudo is not used this way. I have the whole wheel thing set up but I uncomment the option where a password is necessary. I only did that because I'm so used to sudo this and sudo that... I would ssh over to the sever to do something and I would habitually use sudo for something simple and get aggravation. I don't modify the PATH on that machine except to remove .(current directory).

With that being said, though, over time I found that using sudo just as annoying as su -c. Because of the nopasswd option it's clearly preferable but if I'm going to do a series of tasks I'm more apt to using su or even su - if I need something more robust.

dive 12-10-2006 06:09 PM

You can also make an alias:

alias su='sudo su'

so you can su without no pass *if* you put the ALL=(ALL) NOPASSWD:ALL in sudoers file

M$ISBS 12-10-2006 08:26 PM

Does that give a particular user root priveledges without having to keep doing su all the time? isnt that kind of insecure?

pdw_hu 12-11-2006 02:19 AM

I use it for gphoto2 and rioutil (software for my mp3 player), also formounting of stuff not in fstab.

dive 12-11-2006 04:20 AM

Quote:

Originally Posted by M$ISBS
Does that give a particular user root priveledges without having to keep doing su all the time? isnt that kind of insecure?

That particular alias means that a user can su without pass. The sudoers entry means that a user can 'sudo' a program without pass.

I only use this on my own system where there are no other users so it's quite safe. I wouldn't do this in a multi-user situation.

M$ISBS 12-11-2006 07:10 PM

Thanks, I will look into that. Mine is a single user system and I really get frustrated having to type in the root password all the time.

dosnlinux 12-15-2006 02:57 PM

Thanks for all the great replies! My computer's mainly for personal use, security isn't too big of an issue, but I don't think I want to allow myself the ability to sudo everything without a password. (I've typed rm -rf once too many ;) )I think using aliases for stuff like using gphoto and MTP drivers along with not having to use a password would be nice. I'll probably add the pkgtools too. Other than that I think I'll add stuff as I go.

Thank you all very much, and if you still have different ways you use sudo I'd love to hear them.:D

H_TeXMeX_H 12-15-2006 08:12 PM

I don't use sudo, I have found no benefit to using it over su.


All times are GMT -5. The time now is 07:56 PM.