LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-07-2005, 09:23 PM   #1
sporks
Member
 
Registered: Dec 2004
Location: Indonesia
Distribution: Slackware
Posts: 211

Rep: Reputation: 30
Frustrated, file permissions sharing files


I've set up an account for my wife on our home computer since she doesn't care for Enlightenment or whatever other flavor of the week I'm using for my desktop.

I thought it would be simple enough to set up shared files since there are some that both of us, such as our checkbook, write too.

I looked over the tutorial here. Followed it, least I think I did. No dice. I'm in the group I created, she's in the group I created but I still can't write the file. I can read it but can't save changes even though the write permissions for the group are turned on for the file and directories it's in.

I did at one time have it so I could save it. But soon as one of us saved it the write permission for the group dissapeared and the other couldn't write to the file. :?

Any suggestions what I'm doing wrong or need to do?
 
Old 04-07-2005, 10:06 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
What are the ownerships on the file, and what are
ownerships/permissions on the directory that the file
lives in?
It's always easier to help with more detailed info...



Cheers,
Tink
 
Old 04-07-2005, 10:07 PM   #3
blue penguin
LQ Newbie
 
Registered: Dec 2004
Location: New Zealand
Distribution: Debian GNU/Linux (Etch) GRUB, Kubuntu 5.10 GRUB/GNU/Linux
Posts: 27

Rep: Reputation: 15
Who ownes the directory it's in? Maybe that's your problem.

I just created a directory called allusers in the home directory as root, changed the group to users, and changed the permissions so that the group had write access, checking with ls -l along the way that everything was as it should be.
Code:
Aiolos:/home# mkdir allusers
Aiolos:/home# ls -l
total 68
drwxr-sr-x   2 root   staff   4096 2005-04-08 14:27 allusers
[...]
Aiolos:/home# chown root:users allusers
Aiolos:/home# ls -l
total 68
drwxr-sr-x   2 root   users   4096 2005-04-08 14:27 allusers
[..]
Aiolos:/home# chmod g+w allusers/
Aiolos:/home# ls -l
total 68
drwxrwsr-x   2 root   users   4096 2005-04-08 14:27 allusers
[...]
then I created a file in /home/allusers as myself (ja) and changed the permissions so that the group had write access.
Code:
ja@Aiolos:/home/allusers$ touch file1
ja@Aiolos:/home/allusers$ ls -l
total 0
-rw-r--r--  1 ja users 0 2005-04-08 14:55 file1
ja@Aiolos:/home/allusers$ chmod g+w file1
ja@Aiolos:/home/allusers$ ls -l
total 0
-rw-rw-r--  1 ja users 0 2005-04-08 14:55 file1
then I edited it a couple of times with different users but the permissions didn't seem to change and no one had access problems.

I hope this helps

Cheers,
-Jessica
 
Old 04-07-2005, 10:30 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
First thing:
If you add yourself to a group, then you need to completely log out before your user will be recognized as a member of that group. This only applies if you were logged into X as a normal user, and then su'ed to root to make the new group and change permissions. When I say log out completely, I mean log out of X entirely. Opening a new terminal will not work.

Second thing:
Check the umask value of you and your wife's account. You should be able to see it in ~/.bash_profile. If no umask command is there, then check /etc/profile. If your umask is set to 022 (which seems to be the standard setting), then that might be th cause of your checkbook file problems. If the application you use deletes the checkbook, then creates a new one when you save it, then your umask comes into play. This would be very, very odd behavior, but I've seen stranger things. Regardless, the umask will be applied whenever you create new files anyway. You may consider changing it to 002.

Third thing:
There's something blue penguin did that she didn't mention. Look closely at the permissions of the directory created:
Code:
drwxrwsr-x   2 root   users   4096 2005-04-08 14:27 allusers
The thing to notice is the 's' character. That indicates the "setgid" bit is set. When that bit is set (I'll mention how later), all files created in the directory belong to the same group the directory itself belongs to. In other words, creating a file in the allusers directory will automatically belong to the "users" group, because the allusers directory belongs to the users group. As promised, the command to set that bit is:
Code:
chmod 2775 allusers
That command is equivalent to setting up a directory exactly as blue penguin setup her allusers directory. Any files already in the directory will need to be manually changed to belong to the appropriate group if they aren't already.
 
Old 04-09-2005, 12:54 AM   #5
blue penguin
LQ Newbie
 
Registered: Dec 2004
Location: New Zealand
Distribution: Debian GNU/Linux (Etch) GRUB, Kubuntu 5.10 GRUB/GNU/Linux
Posts: 27

Rep: Reputation: 15
Quote:
Originally posted by Dark_Helmet

There's something blue penguin did that she didn't mention. Look closely at the permissions of the directory created:
Code:
drwxrwsr-x   2 root   users   4096 2005-04-08 14:27 allusers
The thing to notice is the 's' character. That indicates the "setgid" bit is set. When that bit is set (I'll mention how later), all files created in the directory belong to the same group the directory itself belongs to. In other words, creating a file in the allusers directory will automatically belong to the "users" group, because the allusers directory belongs to the users group.
Wow that's interesting! I hadn't even noticed that s there. I just thought that any files a user creates are set the group id of the group the user is working as at the time, which in this case has to be the users group.

but this setgid is cool it's like having GPLed folder!

Cheers,
- Jessica

Last edited by blue penguin; 04-09-2005 at 12:55 AM.
 
Old 04-09-2005, 07:39 AM   #6
sporks
Member
 
Registered: Dec 2004
Location: Indonesia
Distribution: Slackware
Posts: 211

Original Poster
Rep: Reputation: 30
Good suggestions here.

I'll sort though 'em and see what I can do.

I did create another directory called shared. Can't remember though, think that one of the users was the owner not root.

Thanks!
 
Old 04-09-2005, 08:19 AM   #7
sporks
Member
 
Registered: Dec 2004
Location: Indonesia
Distribution: Slackware
Posts: 211

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Dark_Helmet
[B]First thing:
If you add yourself to a group, then you need to completely log out before your user will be recognized as a member of that group. This only applies if you were logged into X as a normal user, and then su'ed to root to make the new group and change permissions. When I say log out completely, I mean log out of X entirely. Opening a new terminal will not work.

Second thing:
Check the umask value of you and your wife's account. You should be able to see it in ~/.bash_profile. If no umask command is there, then check /etc/profile. If your umask is set to 022 (which seems to be the standard setting), then that might be th cause of your checkbook file problems. If the application you use deletes the checkbook, then creates a new one when you save it, then your umask comes into play. This would be very, very odd behavior, but I've seen stranger things. Regardless, the umask will be applied whenever you create new files anyway. You may consider changing it to 002.
Ah, so I wasn't crazy. I did everything correctly it was the umask value, I was previously unaware of this.

So for future reference.

Kmymoney2
Kanotix (I'd assume Debain systems in general?)

Edit /etc/profile and set the umask from 022 to 002.

Thanks for the help!
 
Old 04-09-2005, 12:54 PM   #8
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
@blue penguin

Just wanted to elaborate a little on the setgid bit. The behavior I described only applies to directories with that bit set. It has a different meaning when applied to files. When setgid is used on an executable file, it alters the way the program is executed. Specifically, the process starts by belonging to the group owner of the file as opposed to the group the user that started the program belongs to. I believe setgid is ignored by regular (non-executable) files.

There is also a similar setuid bit. For executable with this bit set, the process runs as the owner of the file instead of the user that actually launched it. Again, I think it's ignored by non-executable files and directories.

Lastly there's a "sticky" bit. When the sticky bit is set on a directory, only the owner of the file can delete their files (even if the group has write permissions). This is what's used for the /tmp directory. Everybody can create/delete files in /tmp, but a user only delete files that user owns. The sticky bit is ignored for files.

To modify these permissions, add a leading digit to the chmod command. Setuid corresponds to "read" (4), setgid corresponds to "write" (2), and the sticky bit corresponds to "execute" (1).
 
Old 04-19-2005, 09:13 PM   #9
sporks
Member
 
Registered: Dec 2004
Location: Indonesia
Distribution: Slackware
Posts: 211

Original Poster
Rep: Reputation: 30
Allright, gotta revisit this issue. :roll:

I upgraded my Kanotix and now my "fixes" won't work.

Any ideas?
 
Old 04-20-2005, 08:37 PM   #10
sporks
Member
 
Registered: Dec 2004
Location: Indonesia
Distribution: Slackware
Posts: 211

Original Poster
Rep: Reputation: 30
Ha! Nevermind.

You have to make the primary group the users are members of the group that has permissions on this file.

Last edited by sporks; 04-20-2005 at 08:39 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File/group permissions and sharing kscott121 Linux - Software 3 10-15-2005 10:39 AM
Changing file permissions within a directory for all files. cajunaggie Linux - Newbie 2 02-06-2005 01:53 AM
File permissions for web site files/folders mackayr Linux - Networking 1 12-01-2004 11:49 AM
Frustrated newbie....internet sharing problem caro Linux - Networking 3 06-09-2003 08:05 AM
file sharing with windows, permissions axis Linux - Networking 2 04-08-2003 09:15 AM


All times are GMT -5. The time now is 02:00 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration