LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-25-2010, 09:07 PM   #1
chytraeus
Member
 
Registered: Dec 2008
Distribution: slackware64 openbsd
Posts: 105

Rep: Reputation: 11
trouble with SGID on a shareable folder


I'm running slackware 13.0. I've created a folder called "slackware"
that I'm trying to make shareable shareable by everyone in the group
called "packager".

I added myself and root to the group "packager":
usermod -G packager root
usermod -G packager chytraeus


If i set the permissions to 2777 i can create a file just fine:

root@leo:~# chmod -R 2777 /home/slackware
chytraeus@leo:~$ touch /home/slackware/test_file

But, if i set the permissions to 2770 i cannot create a file:

root@leo:~# chmod -R 2770 /home/slackware
chytraeus@leo:~$ touch /home/slackware/test_file
touch: cannot touch `/home/slackware/test_file': Permission denied

I noticed that if I type:

chytraeus@leo:~$ id -nG chytraeus

I see this:
users packager

But, if type:
chytraeus@leo:~$ id -nG

I see:
users lp wheel floppy audio video cdrom plugdev power netdev scanner

Here is the output on the directory permissions:
chytraeus@leo:~$ ls -ld /home/slackware/
drwxrws--- 4 nobody packager 4096 2010-01-25 20:53 /home/slackware//

Someone able to help?
 
Old 01-25-2010, 09:29 PM   #2
Elemecca
Member
 
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71

Rep: Reputation: 22
Did you add yourself to packagers with 'gpasswd -a chytraeus packager', or did you edit /etc/group manually? Also, what does 'whoami' print?
 
1 members found this post helpful.
Old 01-25-2010, 09:50 PM   #3
chytraeus
Member
 
Registered: Dec 2008
Distribution: slackware64 openbsd
Posts: 105

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by Elemecca View Post
Did you add yourself to packagers with 'gpasswd -a chytraeus packager', or did you edit /etc/group manually? Also, what does 'whoami' print?
Thanks for responding, Elemecca.

I added myself to packagers with usermod -G packager chytraeus.

chytraeus@leo:~$ whoami
chytraeus

Last edited by chytraeus; 01-25-2010 at 09:59 PM.
 
Old 01-25-2010, 11:50 PM   #4
Elemecca
Member
 
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71

Rep: Reputation: 22
So you did. I notice now that you said so in your original post.

'usermod -G' sets, not appends to, your supplementary group list. The command 'usermod -G packager chytraeus' made packager your only supplementary group. To append to the list you need to use '-Ga' instead of '-G'. In order to restore root's and your proper group memberships, run the following commands. '<groups>' will need to be replaced with root's proper group list, see below.
Code:
usermod -G users,lp,wheel,floppy,audio,video,cdrom,plugdev,power,netdev,scanner,packager chytraeus
usermod -G <groups> root
You got different results from the two calls to id because 'id -Gn' queries your effective group membership whereas 'id -Gn chytraeus' queries your membership in /etc/group. Your group membership is only refreshed from /etc/group when you log in, so your effective membership was what it had been before reconfiguration. If you have a root shell that's been logged in since before the reconfiguration you can recover root's proper group membership by querying its effective group list. If you don't, tell me and I'll fire up my Slack13 VM and look it up for you.

Once you log in again your effective group membership will match that in /etc/group and your permissions problem should go away. Remember not to exit your current shell before you restore your proper group list or you may not have the permissions required to do so.
 
1 members found this post helpful.
Old 01-26-2010, 12:36 PM   #5
chytraeus
Member
 
Registered: Dec 2008
Distribution: slackware64 openbsd
Posts: 105

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by Elemecca View Post
So you did. I notice now that you said so in your original post.

'usermod -G' sets, not appends to, your supplementary group list. The command 'usermod -G packager chytraeus' made packager your only supplementary group. To append to the list you need to use '-Ga' instead of '-G'.
Okay, slackware's usermod lacks the -a option.

Quote:
In order to restore root's and your proper group memberships, run the following commands. '<groups>' will need to be replaced with root's proper group list, see below.
Code:
usermod -G users,lp,wheel,floppy,audio,video,cdrom,plugdev,power,netdev,scanner,packager chytraeus
usermod -G <groups> root
Quote:
You got different results from the two calls to id because 'id -Gn' queries your effective group membership whereas 'id -Gn chytraeus' queries your membership in /etc/group. Your group membership is only refreshed from /etc/group when you log in, so your effective membership was what it had been before reconfiguration. If you have a root shell that's been logged in since before the reconfiguration you can recover root's proper group membership by querying its effective group list. If you don't, tell me and I'll fire up my Slack13 VM and look it up for you.
Querying root's groups shows the following:

Code:
root@leo:/home/slackware# id -Gn
root
root@leo:/home/slackware# id
uid=0(root) gid=0(root) groups=0(root)
not sure if the results from id are as they should be - don't know what groups root should belong to.

Quote:
Once you log in again your effective group membership will match that in /etc/group and your permissions problem should go away. Remember not to exit your current shell before you restore your proper group list or you may not have the permissions required to do so.
 
Old 01-26-2010, 11:14 PM   #6
Elemecca
Member
 
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71

Rep: Reputation: 22
If your usermod lacks '-Ga' you should use 'gpasswd -a <user> <group>' instead. This is probably a better way than 'usermod -Ga' anyway, as gpasswd is the tool used for most group maintenance.

On my Gentoo system root has group membership 'root bin daemon sys adm disk wheel floppy dialout tape video'. This is probably wrong for your Slack13 system, just showing that root usually belongs to more groups than just 'root'. Give me a minute and I'll boot up my Slack13 VM and post root's default group membership for you.
 
1 members found this post helpful.
Old 01-27-2010, 01:11 AM   #7
Elemecca
Member
 
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71

Rep: Reputation: 22
Okay, on Slack13 root's proper group membership is 'root bin daemon sys adm disk wheel floppy audio video cdrom tape plugdev power netdev scanner'.

So the command to restore it (with the new group) is 'usermod -G root,bin,daemon,sys,adm,disk,wheel,floppy,audio,video,cdrom,tape,plugdev,power,netdev,scanner,packag er root'.

EDIT: Apparently there's something wrong with the forum software. I'm seeing a space before the 'er' in 'packager' in the post but not in the edit box. The space shouldn't be there.

Last edited by Elemecca; 01-27-2010 at 01:13 AM. Reason: See EDIT: line.
 
Old 01-27-2010, 04:40 PM   #8
chytraeus
Member
 
Registered: Dec 2008
Distribution: slackware64 openbsd
Posts: 105

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by Elemecca View Post
Okay, on Slack13 root's proper group membership is 'root bin daemon sys adm disk wheel floppy audio video cdrom tape plugdev power netdev scanner'.

So the command to restore it (with the new group) is 'usermod -G root,bin,daemon,sys,adm,disk,wheel,floppy,audio,video,cdrom,tape,plugdev,power,netdev,scanner,packag er root'.

EDIT: Apparently there's something wrong with the forum software. I'm seeing a space before the 'er' in 'packager' in the post but not in the edit box. The space shouldn't be there.


Alright, users are with their correct groups and I can now write to /home/slackware.

Code:
bash-3.1$ whoami
chytraeus

bash-3.1$ pwd
/home/chytraeus

bash-3.1$ ls -ld /home/slackware/
drwxrws--- 3 nobody packager 4096 2010-01-26 17:32 /home/slackware/

bash-3.1$ touch /home/slackware/test_file.txt

bash-3.1$ ls -l /home/slackware/test_file.txt
-rw-r--r-- 1 chytraeus packager 0 2010-01-27 16:40 /home/slackware/test_file.txt
Thank you very much.
 
  


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
apache2 folder 'var/www' is not shareable; can not edit the index.html file mcanallyd Linux - Newbie 2 06-18-2009 05:46 PM
folder opening trouble raphtor Linux - Newbie 1 09-19-2008 10:41 PM
Folder access and trouble shooting mdar Slackware 2 01-06-2006 09:34 PM
trouble mounting linux shared folder jerryfreak Linux - Networking 1 10-15-2004 12:41 PM
Folder Permissions Trouble 69_rs_ss Linux - General 3 01-16-2004 06:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:00 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