It is currently Tue May 21, 2013 2:36 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [How to] use netpkg with sudo
PostPosted: Wed Sep 20, 2006 7:23 pm 
Experienced Zenwalker
Experienced Zenwalker

Joined: Sun Mar 19, 2006 8:17 am
Posts: 178
Goal: be able to type sudo netpkg auto-install apache to install apache.
First of all you must make sure that you are allowed to use sudo. In /etc/sudoers, add this line:
Code:
%wheel   ALL=(ALL)   NOPASSWD: ALL

or, if you want a password to be required:
Code:
%wheel   ALL=(ALL)   ALL

For most Zenwalk users, this is only a matter of uncommenting (removing the # from the start of) these lines, as they are already there.

Then, you must be a member of group wheel. This is easiest done using userconfig in the XFCE menu, located in the system submenu. Go to list user, find yourself in the list, and add wheel to the comma separated "membership" field.

Now, test your sudo by typing sudo mousepad and take another look at the sudoers file to verify that you're actually running as root (this file can't be read by others by default).

If you try to type sudo netpkg auto-install apache now, it will not find the command netpkg. To solve this, edit the file ~/.bashrc, in other words the file .bashrc in your home directory. At the end of the file, add this line:
Code:
export PATH=$PATH:/usr/sbin:/sbin


Close and open the terminal window. You should now be able to use netpkg together with sudo.


 Profile Send private message  
 
 Post subject: Re: [How to] use netpkg with sudo
PostPosted: Wed Sep 20, 2006 8:34 pm 

One of the reasons MS Windows is considered less secure than the averag *nix OS is that normal users are not always working as "administrator". What you just did above almost eliminates that benefit.

The effects of what you have done are far wider reaching than just making 'netpkg' availlable. It makes all users in the group 'wheel' able to run any command on any host as any user. So this is not only a breach in the security of the system on which you put this command, but a breach in the security of any unix machine in your network that accepts commands from this host too.

/usr/sbin & /sbin are not in the path of a normal user because the commands in those directories should not be run as a normal user.

And what is the benefit of what you have done? Virtually nothing. Typing this is almost as easy:
Code:
$ su -
Password:
# netpkg auto-install apache
# exit
$
It's exactly five keystrokes more.

You are free to do on your own system what you want. But the unwary be warned that this is not a good idea.

_____  _____  _____

As a more possitive conclusion. Try:
Code:
%wheel myhost = NOPASSWD:/usr/sbin/netpkg

Where 'myhost' is the name of your computer. Plus your alteration of the PATH (minus :/sbin). This actually does what the title of this thread suggests (and nothing more) in a more safe way.


Last edited by Tibors on Wed Sep 20, 2006 8:57 pm, edited 1 time in total.

  
 
 Post subject: Re: [How to] use netpkg with sudo
PostPosted: Thu Sep 21, 2006 1:44 pm 
Experienced Zenwalker
Experienced Zenwalker

Joined: Sun Mar 19, 2006 8:17 am
Posts: 178
I know what I did, and if the user has to type a password with sudo it's not that insecure. If you don't want it that way, just don't follow this how-to.

By the way, did you actually test your alternate solution?


 Profile Send private message  
 
 Post subject: Re: [How to] use netpkg with sudo
PostPosted: Thu Sep 21, 2006 2:33 pm 

tsg1zzn wrote:
By the way, did you actually test your alternate solution?
Yes.


You might know what you did. But the title of the thread and what you actually did didn't compare. So the unwary new user who reads howto's to learn linux got very bad advice.


  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


 Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: