LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Permission inheritance via Samba (https://www.linuxquestions.org/questions/linux-newbie-8/permission-inheritance-via-samba-4175436396/)

adol83 11-09-2012 06:42 AM

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

teckk 11-10-2012 08:19 AM

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.

adol83 11-10-2012 10:13 AM

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?

adol83 12-14-2012 05:38 AM

Waiting for some suggestions :)

teckk 12-14-2012 09:17 AM

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


adol83 12-14-2012 10:17 AM

1 Attachment(s)
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.

chrism01 12-16-2012 06:39 PM

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 ....

adol83 12-18-2012 03:01 AM

Thank you, got it :)


All times are GMT -5. The time now is 02:03 PM.