LinuxQuestions.org
Register a domain and help support LQ
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 11-09-2012, 07:42 AM   #1
adol83
Member
 
Registered: Jul 2012
Location: Rome
Distribution: RHEL6, CentOs
Posts: 92

Rep: Reputation: 1
Permission inheritance via Samba


Hello to everyone,

I'm having an issue about umask . Now,

I have a Samba directory shared called /mydirectory

the user can access to this directory is an "administrator" user from Windows. Directory and Samba does it works.

Now, when i use my directory under windows owner and group are "administrator" and when i log into my Rhel system as root and i create a directory under /mydirectory owner and group is root.

What i really want is "mkdir directory" and allow the new directory inherit the "administrator" user from parent directory. But mkdir has no this kind of function, therefore over this forum i saw "umask" could help but umask that i know it's only for permission to files and not for a specific user or group.

How can i workaround this?

In poor words,

1. administrator open the samba directory, the samba directory has administrator:administrator as owner and group

2. administrator create the "goofy" directory

3. "goofy" directory created from another system must inherit owner and group so it will be "administrator:administrator"

That's my aim.

Davide
 
Old 11-10-2012, 09:19 AM   #2
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,843

Rep: Reputation: 225Reputation: 225Reputation: 225
Code:
mkdir /mydirectory/goofy
chown administrator /mydirectory/goofy
chgrp administrator /mydirectory/goofy
Quote:
"goofy" directory created from another system
If they have permission to make a directory then they have permission to configure it.
chown -R /mydirectory/ will change all of the sub directories.
 
Old 11-10-2012, 11:13 AM   #3
adol83
Member
 
Registered: Jul 2012
Location: Rome
Distribution: RHEL6, CentOs
Posts: 92

Original Poster
Rep: Reputation: 1
There's no "mkdir" for inherit user, i have to switch anytime with chown and chgrp

there's no method to inherit for any subdirectory the parent user:group without anytime switch with chown and chgrp?

can't umask be useful for that? Or should i create an alias command to include "mkdir, chown, chgrp" commands for that folder?
 
Old 12-14-2012, 06:38 AM   #4
adol83
Member
 
Registered: Jul 2012
Location: Rome
Distribution: RHEL6, CentOs
Posts: 92

Original Poster
Rep: Reputation: 1
Waiting for some suggestions
 
Old 12-14-2012, 10:17 AM   #5
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,843

Rep: Reputation: 225Reputation: 225Reputation: 225
If I understand what you are wanting to do, why don't you make a simple shell script for it? Something like.


Code:
#! /bin/bash

echo "Enter Directory Name"
while read name
do
mkdir "$name"
chmod 777 "$name"
chown administrator:administrator "$name"

done
 
1 members found this post helpful.
Old 12-14-2012, 11:17 AM   #6
adol83
Member
 
Registered: Jul 2012
Location: Rome
Distribution: RHEL6, CentOs
Posts: 92

Original Poster
Rep: Reputation: 1
It does works dude. Thank you. There's a little error, in attachment though the OS is in italian.

If you need any translation let me know.
Attached Thumbnails
Click image for larger version

Name:	Cattura.PNG
Views:	18
Size:	21.0 KB
ID:	11408  
 
Old 12-16-2012, 07:39 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
I don't think you need a loop there if you only intend to create dirs one at a time.
Alternately, you could add an option after read to see if its eg 'zz', in which case it breaks out and exits. Your choice.

Incidentally, Linux is case sensitive, so davide != Davide ....
 
1 members found this post helpful.
Old 12-18-2012, 04:01 AM   #8
adol83
Member
 
Registered: Jul 2012
Location: Rome
Distribution: RHEL6, CentOs
Posts: 92

Original Poster
Rep: Reputation: 1
Thank you, got it
 
  


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
Samba MODIFY permission needs 'x' permission set in Linux? jlinkels Linux - Software 6 11-13-2009 10:30 AM
NFS: folder permission inheritance Swakoo Linux - General 5 06-25-2007 05:29 AM
How exactly does Linux file permission inheritance work HGeneAnthony Linux - Newbie 5 04-14-2006 11:20 AM
is it possible to set a fixed permission inheritance for child objects? Berkut83 Red Hat 2 01-20-2006 11:15 AM
File permission inheritance HowTo ? Satriani Linux - Security 4 11-26-2004 06:13 AM


All times are GMT -5. The time now is 06:42 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration