LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sticky Bit? (ie: chmod 2770 vs chmod 770) (http://www.linuxquestions.org/questions/linux-newbie-8/sticky-bit-ie-chmod-2770-vs-chmod-770-a-657820/)

JeffC1 07-23-2008 08:45 PM

Sticky Bit? (ie: chmod 2770 vs chmod 770)
 
From what I understand - performing a CHMOD 2770 on a directory makes all files created in that directory have the same group ownership.

WHAT IF..

I have two directories that were CHMOD 2770's within each other?

Say I perform a chmod -r 2770 on MainShare/

drwxrws--- 3 nick users 1024 Jan 19 11:19 MainShare/

However..I also performed a chmod -r 2770 on the folder /MainShare/Finance

drwxrws--- nick finance 1024 11:19 Finance/

If a user creates a file inside of Finance, will it have the proper group ownership of "finance"? or will it inherit the /MainShare "user" group?

I'm using Samba and would just like to enforce that the file created, will always match the group of the folder its in...

cyclepathology 07-23-2008 09:05 PM

Quote:

Originally Posted by somesnapper (Post 3224345)
If a user creates a file inside of Finance, will it have the proper group ownership of "finance"?

Yes.

Quote:

Originally Posted by somesnapper (Post 3224345)
or will it inherit the /MainShare "user" group?

No.

Mr. C. 07-23-2008 09:37 PM

A concept clarification - there is no inheriting in *nix permissions. For the sticky bit, the parent directory is examined, and that's all.

tanoloco 03-17-2010 09:36 AM

Quote:

Originally Posted by Mr. C. (Post 3224380)
A concept clarification - there is no inheriting in *nix permissions. For the sticky bit, the parent directory is examined, and that's all.


Hello!

Ok for that but is there a way to make a user create files / folder
with permissions 1750 for example?
In other words if I create a folder with 1770 how can I set things in order that users can create staff in it with sticky bit already on?

acl ... umask ... sticky?

Help! :)

chrism01 03-17-2010 08:57 PM

Setting the Sticky bit (t perm option) on a dir will enforce the fact that only the owner of a file in that dir can delete it.
You can't have the t perm option on a file.

tanoloco 03-18-2010 04:56 AM

thank you for your reply! :)

You're right: I was wrong because I've always seen I'm able to chmod +t a file but I never tested that it has no effect :( ... never tried it before.

Thanks for clarifying this for me :)


Anyhow I'm still trying to understand how to inherit the sticky bit on new folders (he he he:)) under a folder with sticky bit on.

I explain it better:
I chmod 1770 a test_folder
If I set the general umask, or acl mask specifically on it, to be 770
users will create new folders with 770 permissions of course but no sticky bit!

umask and mask seem to work only with the last three digits .. or am I wrong? ... so no way to inherit the sticky bit even if I set a mask with 4 digits as for example 6007

So how to permit users to create new folder already with the sticky bit activated under test_folder??? :confused:

Maybe only a cron job can chmod 1770 -R test_folder.

But has this got a sense?

crts 03-18-2010 05:01 AM

Quote:

Maybe only a cron job can chmod 1770 -R test_folder.
If you want to change permissions only inside a specific directory then you might want to try incrond.

chrism01 03-18-2010 07:39 AM

I'm pretty sure you can't 'inherit' the sticky bit, or any perms really. Linux doesn't inherit, it's all down to umask & acls. I'd be interested to know if you can enforce the sticky bit via those, but I've never heard of it. If I was a betting man I'd bet it's strictly a chmod thing... ;)


All times are GMT -5. The time now is 09:08 PM.