LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 10-20-2005, 05:36 AM   #1
nanjil
Member
 
Registered: Jul 2005
Posts: 70

Rep: Reputation: 15
group permissions


hello:

I find that only root has permissions to run programs like mount.
So I created a group called admin. I want to enable another entity besides root to run programs like mount. how do i assign group permissions to executable programs?

thanx
 
Old 10-20-2005, 06:43 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
groupadd, chgrp, and chmod are the commands you need here.

chgrp <groupname> <file> changes the group ownership of a file to whatever group you selected. The group has to exist for this to work. You can add a group with the groupadd program.

chmod is a bit more complex.

There are basic four three bit numbers involved. For now, we will skip the first number. The second number is owner permissions, second is group permissions, third is everyone else.

So, lets break it down. The three bits stand for read, write, and exec.
read = 100 (binary) or 4 (decimal)
write = 010 (binary) or 2 (decimal)
execute = 001 (binary) or 1 (decimal)
Permission can be added together. 6 would be read and write but not execute. 7 would be read write and execute, ect.

So, say we have the mount program for example.
chmod 0550 /sbin/mount
This gives read and execute privileges to the owner of the file (root) and the group designated to the file (in your case admin). It also gives no rights to other users.

Now... that still isn't enough in the case of programs like mount. Mount always has to be executed as root because of the nature of what it does... That is where the first 3-bit number in 0550 comes into play.

The first number is also a 3 bit number, but the bits stand for different things then read, write and execute.
set uid on exec = 100 (binary), 4 (decimal)
set gid on exec = 010 (binary), 2 (decimal)
sticky bit = 001 (binary), 1 (decimal)

The one we really care about here is the set uid on exec. What this means is no matter who executes the program (providing they have exec privileges) it gets run as if the owner of the file ran it.

So, the actual command you would want for mount is:
chmod 4550 /sbin/mount
This assumes your mount program is located in /sbin. If not... change the line accordingly.

To summarize...
groupadd admin
chgrp admin /sbin/mount
chmod 1550 /sbin/mount

This should allow any user in the group admin to run mount.

For more info
man groupadd
man chgrp
man chown
man chmod
 
Old 10-20-2005, 11:11 AM   #3
nanjil
Member
 
Registered: Jul 2005
Posts: 70

Original Poster
Rep: Reputation: 15
thank you for that nice reply. I will try it this evening.
while we are in the subject can teh files be owned by multiple groups or only one group is allowed ownership?

thanx
 
Old 10-20-2005, 01:44 PM   #4
BDHamp
Member
 
Registered: Mar 2005
Distribution: Ubuntu 9.10, Mint 8, Slackware 12
Posts: 105

Rep: Reputation: 16
Re: group permissions

Quote:
Originally posted by nanjil


I find that only root has permissions to run programs like mount.

Just out of curiosity, were you having a problem mounting something specific?

I ask because I started doing what you're doing here and then realized it wasn't a problem with permission to run mount, rather permissing to mount specific devices. When I installed 10.0, the default fstab didn't give permission for users to mount my CD/DVD drive, so I had to edit that file, and all was well.

Just mentioning it because of your mentioning mount. Not knowing what the specific issue was, I thought the solution might be less complex than creating new users and setting a permission policy.
 
Old 10-20-2005, 01:51 PM   #5
nanjil
Member
 
Registered: Jul 2005
Posts: 70

Original Poster
Rep: Reputation: 15
actually I had a querious set of problems. It mounted one of my filesystems with user/group id of 500. Then I had to switch to root to reset the permissions.

The other problem I had was I installed a student version of matlab which required you to have the cd in drive for it to run. in suse teh cd was mounted as /media/dvdrecorder and /dev/dvdrecorder. for matlab to work i had to mount the same device on /cdrom.
another curious thing was even though in /etc/fstab the entry was /dev/dvdrecorder, I foudn that the true devie /dev/hdc. I could not figure how /dev/hdc was mapped to /dev/dvdrecorder.


so it goes.....
 
  


Reply



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
regarding group permissions zameer_india Linux - Networking 1 02-11-2005 04:07 AM
group permissions mikeghet Linux - Newbie 1 12-06-2004 03:49 AM
Group Permissions (m9.2) PaladinCowboy75 Mandriva 4 05-06-2004 08:20 AM
Group Permissions mallikarjun Linux - Security 4 07-03-2002 04:37 PM
group permissions once Linux - Newbie 5 06-02-2002 03:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 06:00 PM.

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