LinuxQuestions.org
Visit Jeremy's Blog.
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 07-23-2008, 09:45 PM   #1
JeffC1
Member
 
Registered: May 2008
Posts: 89

Rep: Reputation: 15
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...

Last edited by JeffC1; 07-23-2008 at 09:47 PM.
 
Old 07-23-2008, 10:05 PM   #2
cyclepathology
LQ Newbie
 
Registered: Sep 2007
Location: Seattle, WA
Distribution: Red Hat, Ubuntu, PCLinuxOS, Fedora, Vector Linux, CentOS, HP-UX, Solaris, AIX, FreeBSD
Posts: 28

Rep: Reputation: 15
Quote:
Originally Posted by somesnapper View Post
If a user creates a file inside of Finance, will it have the proper group ownership of "finance"?
Yes.

Quote:
Originally Posted by somesnapper View Post
or will it inherit the /MainShare "user" group?
No.
 
Old 07-23-2008, 10:37 PM   #3
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
A concept clarification - there is no inheriting in *nix permissions. For the sticky bit, the parent directory is examined, and that's all.
 
Old 03-17-2010, 10:36 AM   #4
tanoloco
LQ Newbie
 
Registered: Mar 2010
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by Mr. C. View Post
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!
 
Old 03-17-2010, 09:57 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,425

Rep: Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786
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.
 
Old 03-18-2010, 05:56 AM   #6
tanoloco
LQ Newbie
 
Registered: Mar 2010
Posts: 2

Rep: Reputation: 0
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???

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

But has this got a sense?

Last edited by tanoloco; 03-18-2010 at 05:57 AM.
 
Old 03-18-2010, 06:01 AM   #7
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
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.
 
Old 03-18-2010, 08:39 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,425

Rep: Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786Reputation: 2786
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...
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
chmod 775 to only the directories and chmod 664 to only the files? apachenew Linux - Security 6 09-27-2007 04:26 PM
Using chmod gamewolf Linux - Newbie 9 06-09-2007 11:37 AM
chmod, external usb, vfat - can't chmod a directory itsjustme Slackware 2 04-02-2006 05:23 PM
What can we do if we type chmod ugo-x /bin/chmod ?????? bunny123 Linux - Software 3 02-01-2005 09:53 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 06:37 AM

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

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