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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-25-2010, 10:07 PM
|
#1
|
Member
Registered: Dec 2008
Distribution: slackware64 openbsd
Posts: 105
Rep:
|
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?
|
|
|
01-25-2010, 10:29 PM
|
#2
|
Member
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71
Rep:
|
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.
|
01-25-2010, 10:50 PM
|
#3
|
Member
Registered: Dec 2008
Distribution: slackware64 openbsd
Posts: 105
Original Poster
Rep:
|
Quote:
Originally Posted by Elemecca
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 10:59 PM.
|
|
|
01-26-2010, 12:50 AM
|
#4
|
Member
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71
Rep:
|
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.
|
01-26-2010, 01:36 PM
|
#5
|
Member
Registered: Dec 2008
Distribution: slackware64 openbsd
Posts: 105
Original Poster
Rep:
|
Quote:
Originally Posted by Elemecca
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.
|
|
|
|
01-27-2010, 12:14 AM
|
#6
|
Member
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71
Rep:
|
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.
|
01-27-2010, 02:11 AM
|
#7
|
Member
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71
Rep:
|
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 02:13 AM.
Reason: See EDIT: line.
|
|
|
01-27-2010, 05:40 PM
|
#8
|
Member
Registered: Dec 2008
Distribution: slackware64 openbsd
Posts: 105
Original Poster
Rep:
|
Quote:
Originally Posted by Elemecca
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.
|
|
|
All times are GMT -5. The time now is 10:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|