Any way to force files to inherit owner permissions from parent directory?
up vote
3
down vote
favorite
Is there any way to force a file, created within a directory, to inherit ownership from the parent directory? I tried the sticky bit, but that doesn't seem to work.
Example of what I'm looking for:
drwxrwxr-x www-data somegroup parentdir
When parentdir/newfile.htm is created by someuser:
-rwxrwxr-x www-data somegroup newfile.htm
NOT
-rwxr-xr-x someuser somegroup newfile.htm
Any way this can be done? Thank you!
permissions
add a comment |
up vote
3
down vote
favorite
Is there any way to force a file, created within a directory, to inherit ownership from the parent directory? I tried the sticky bit, but that doesn't seem to work.
Example of what I'm looking for:
drwxrwxr-x www-data somegroup parentdir
When parentdir/newfile.htm is created by someuser:
-rwxrwxr-x www-data somegroup newfile.htm
NOT
-rwxr-xr-x someuser somegroup newfile.htm
Any way this can be done? Thank you!
permissions
The sticky bit or the setgid bit?
– muru
May 22 '15 at 6:23
@muru, I believe they're one in the same. What I'm calling the sticky bit is the flag that makes sure children inherit the group owner from the parent directory.
– S. Wyatt Young
May 22 '15 at 22:51
That's the setgid bit. The sticky bit is what you see on/tmp
- which prevents others from deleting your files.
– muru
May 22 '15 at 23:29
@muru: Ah! Thank you for clarifying that bit for me.
– S. Wyatt Young
May 23 '15 at 3:26
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Is there any way to force a file, created within a directory, to inherit ownership from the parent directory? I tried the sticky bit, but that doesn't seem to work.
Example of what I'm looking for:
drwxrwxr-x www-data somegroup parentdir
When parentdir/newfile.htm is created by someuser:
-rwxrwxr-x www-data somegroup newfile.htm
NOT
-rwxr-xr-x someuser somegroup newfile.htm
Any way this can be done? Thank you!
permissions
Is there any way to force a file, created within a directory, to inherit ownership from the parent directory? I tried the sticky bit, but that doesn't seem to work.
Example of what I'm looking for:
drwxrwxr-x www-data somegroup parentdir
When parentdir/newfile.htm is created by someuser:
-rwxrwxr-x www-data somegroup newfile.htm
NOT
-rwxr-xr-x someuser somegroup newfile.htm
Any way this can be done? Thank you!
permissions
permissions
asked May 22 '15 at 6:00
S. Wyatt Young
1612
1612
The sticky bit or the setgid bit?
– muru
May 22 '15 at 6:23
@muru, I believe they're one in the same. What I'm calling the sticky bit is the flag that makes sure children inherit the group owner from the parent directory.
– S. Wyatt Young
May 22 '15 at 22:51
That's the setgid bit. The sticky bit is what you see on/tmp
- which prevents others from deleting your files.
– muru
May 22 '15 at 23:29
@muru: Ah! Thank you for clarifying that bit for me.
– S. Wyatt Young
May 23 '15 at 3:26
add a comment |
The sticky bit or the setgid bit?
– muru
May 22 '15 at 6:23
@muru, I believe they're one in the same. What I'm calling the sticky bit is the flag that makes sure children inherit the group owner from the parent directory.
– S. Wyatt Young
May 22 '15 at 22:51
That's the setgid bit. The sticky bit is what you see on/tmp
- which prevents others from deleting your files.
– muru
May 22 '15 at 23:29
@muru: Ah! Thank you for clarifying that bit for me.
– S. Wyatt Young
May 23 '15 at 3:26
The sticky bit or the setgid bit?
– muru
May 22 '15 at 6:23
The sticky bit or the setgid bit?
– muru
May 22 '15 at 6:23
@muru, I believe they're one in the same. What I'm calling the sticky bit is the flag that makes sure children inherit the group owner from the parent directory.
– S. Wyatt Young
May 22 '15 at 22:51
@muru, I believe they're one in the same. What I'm calling the sticky bit is the flag that makes sure children inherit the group owner from the parent directory.
– S. Wyatt Young
May 22 '15 at 22:51
That's the setgid bit. The sticky bit is what you see on
/tmp
- which prevents others from deleting your files.– muru
May 22 '15 at 23:29
That's the setgid bit. The sticky bit is what you see on
/tmp
- which prevents others from deleting your files.– muru
May 22 '15 at 23:29
@muru: Ah! Thank you for clarifying that bit for me.
– S. Wyatt Young
May 23 '15 at 3:26
@muru: Ah! Thank you for clarifying that bit for me.
– S. Wyatt Young
May 23 '15 at 3:26
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You problem (it's not really a problem) raises in two parts as I understand from you.
First you want to give ownership of files created by a user in that directory directly to the apache user www-data
. This can't be done that way.
In real life You can't give something to your friend if he doesn't want it!!
Same thing here, you can't give the ownership to some user without his permission.
So how to solve this here:
you still need to make chown
sudo chown www-data newfile.htm
The other needed is to change the permission of a file to inherits permission of parent directory.
This is not a good habit since the directory normally have execute permission x
to make cd
available in. But x
for a normal file make it executable, and as those files as you mentioned are owned by www-data, this also makes you in trouble with a huge security threat, so my advice don't do it
But anyway if you still want to try : take a look for those two questions
https://superuser.com/questions/264383/how-to-set-file-permissions-so-that-new-files-inherit-same-permissions
https://superuser.com/questions/151911/how-to-make-new-file-permission-inherit-from-the-parent-directory
Not what I'm looking for. I'm looking to avoid changing permissions manually. Also, while HTML files don't need executability, scripts do. I might just be running scripts. :)
– S. Wyatt Young
May 22 '15 at 22:55
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You problem (it's not really a problem) raises in two parts as I understand from you.
First you want to give ownership of files created by a user in that directory directly to the apache user www-data
. This can't be done that way.
In real life You can't give something to your friend if he doesn't want it!!
Same thing here, you can't give the ownership to some user without his permission.
So how to solve this here:
you still need to make chown
sudo chown www-data newfile.htm
The other needed is to change the permission of a file to inherits permission of parent directory.
This is not a good habit since the directory normally have execute permission x
to make cd
available in. But x
for a normal file make it executable, and as those files as you mentioned are owned by www-data, this also makes you in trouble with a huge security threat, so my advice don't do it
But anyway if you still want to try : take a look for those two questions
https://superuser.com/questions/264383/how-to-set-file-permissions-so-that-new-files-inherit-same-permissions
https://superuser.com/questions/151911/how-to-make-new-file-permission-inherit-from-the-parent-directory
Not what I'm looking for. I'm looking to avoid changing permissions manually. Also, while HTML files don't need executability, scripts do. I might just be running scripts. :)
– S. Wyatt Young
May 22 '15 at 22:55
add a comment |
up vote
0
down vote
You problem (it's not really a problem) raises in two parts as I understand from you.
First you want to give ownership of files created by a user in that directory directly to the apache user www-data
. This can't be done that way.
In real life You can't give something to your friend if he doesn't want it!!
Same thing here, you can't give the ownership to some user without his permission.
So how to solve this here:
you still need to make chown
sudo chown www-data newfile.htm
The other needed is to change the permission of a file to inherits permission of parent directory.
This is not a good habit since the directory normally have execute permission x
to make cd
available in. But x
for a normal file make it executable, and as those files as you mentioned are owned by www-data, this also makes you in trouble with a huge security threat, so my advice don't do it
But anyway if you still want to try : take a look for those two questions
https://superuser.com/questions/264383/how-to-set-file-permissions-so-that-new-files-inherit-same-permissions
https://superuser.com/questions/151911/how-to-make-new-file-permission-inherit-from-the-parent-directory
Not what I'm looking for. I'm looking to avoid changing permissions manually. Also, while HTML files don't need executability, scripts do. I might just be running scripts. :)
– S. Wyatt Young
May 22 '15 at 22:55
add a comment |
up vote
0
down vote
up vote
0
down vote
You problem (it's not really a problem) raises in two parts as I understand from you.
First you want to give ownership of files created by a user in that directory directly to the apache user www-data
. This can't be done that way.
In real life You can't give something to your friend if he doesn't want it!!
Same thing here, you can't give the ownership to some user without his permission.
So how to solve this here:
you still need to make chown
sudo chown www-data newfile.htm
The other needed is to change the permission of a file to inherits permission of parent directory.
This is not a good habit since the directory normally have execute permission x
to make cd
available in. But x
for a normal file make it executable, and as those files as you mentioned are owned by www-data, this also makes you in trouble with a huge security threat, so my advice don't do it
But anyway if you still want to try : take a look for those two questions
https://superuser.com/questions/264383/how-to-set-file-permissions-so-that-new-files-inherit-same-permissions
https://superuser.com/questions/151911/how-to-make-new-file-permission-inherit-from-the-parent-directory
You problem (it's not really a problem) raises in two parts as I understand from you.
First you want to give ownership of files created by a user in that directory directly to the apache user www-data
. This can't be done that way.
In real life You can't give something to your friend if he doesn't want it!!
Same thing here, you can't give the ownership to some user without his permission.
So how to solve this here:
you still need to make chown
sudo chown www-data newfile.htm
The other needed is to change the permission of a file to inherits permission of parent directory.
This is not a good habit since the directory normally have execute permission x
to make cd
available in. But x
for a normal file make it executable, and as those files as you mentioned are owned by www-data, this also makes you in trouble with a huge security threat, so my advice don't do it
But anyway if you still want to try : take a look for those two questions
https://superuser.com/questions/264383/how-to-set-file-permissions-so-that-new-files-inherit-same-permissions
https://superuser.com/questions/151911/how-to-make-new-file-permission-inherit-from-the-parent-directory
edited Mar 20 '17 at 10:18
Community♦
1
1
answered May 22 '15 at 6:19
Maythux
49.9k32164214
49.9k32164214
Not what I'm looking for. I'm looking to avoid changing permissions manually. Also, while HTML files don't need executability, scripts do. I might just be running scripts. :)
– S. Wyatt Young
May 22 '15 at 22:55
add a comment |
Not what I'm looking for. I'm looking to avoid changing permissions manually. Also, while HTML files don't need executability, scripts do. I might just be running scripts. :)
– S. Wyatt Young
May 22 '15 at 22:55
Not what I'm looking for. I'm looking to avoid changing permissions manually. Also, while HTML files don't need executability, scripts do. I might just be running scripts. :)
– S. Wyatt Young
May 22 '15 at 22:55
Not what I'm looking for. I'm looking to avoid changing permissions manually. Also, while HTML files don't need executability, scripts do. I might just be running scripts. :)
– S. Wyatt Young
May 22 '15 at 22:55
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f626841%2fany-way-to-force-files-to-inherit-owner-permissions-from-parent-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The sticky bit or the setgid bit?
– muru
May 22 '15 at 6:23
@muru, I believe they're one in the same. What I'm calling the sticky bit is the flag that makes sure children inherit the group owner from the parent directory.
– S. Wyatt Young
May 22 '15 at 22:51
That's the setgid bit. The sticky bit is what you see on
/tmp
- which prevents others from deleting your files.– muru
May 22 '15 at 23:29
@muru: Ah! Thank you for clarifying that bit for me.
– S. Wyatt Young
May 23 '15 at 3:26