Protect overwriting folder content
Clash Royale CLAN TAG#URR8PPP
Is there a way (with acl's) to protect the contents of a folder? Users should create files inside a folder but not overwrite/edit/delete them. Is this possible?
linux permissions acl
add a comment |
Is there a way (with acl's) to protect the contents of a folder? Users should create files inside a folder but not overwrite/edit/delete them. Is this possible?
linux permissions acl
Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.
– RoVo
Jan 23 at 13:40
add a comment |
Is there a way (with acl's) to protect the contents of a folder? Users should create files inside a folder but not overwrite/edit/delete them. Is this possible?
linux permissions acl
Is there a way (with acl's) to protect the contents of a folder? Users should create files inside a folder but not overwrite/edit/delete them. Is this possible?
linux permissions acl
linux permissions acl
edited Jan 23 at 14:40
Jeff Schaller
41.2k1056131
41.2k1056131
asked Jan 23 at 13:04
Slim OntarioSlim Ontario
111
111
Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.
– RoVo
Jan 23 at 13:40
add a comment |
Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.
– RoVo
Jan 23 at 13:40
Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.
– RoVo
Jan 23 at 13:40
Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.
– RoVo
Jan 23 at 13:40
add a comment |
1 Answer
1
active
oldest
votes
One might use inotifywait
to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools
.
Create a script, perhaps /usr/local/sbin/inbox.sh
, as follows.
#!/usr/bin/env bash
inotifywait -m -e create "/path/to/directory" |
while read path event file; do
if [ "$event" = "CREATE" ]; then
chown root:root "$path$file"
fi
done
Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh
). Then run it at boot time from, say, /etc/rc.local
or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &
.
According to the manual, -m
monitors indefinitely, and -e
watches for a specific event. Within the while
loop, it could be possible to receive an event such as CREATE,ISDIR
, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if
statement contains a command to respond only to new files, which are represented with the event, CREATE
. The path
variable from inotifywait
has a trailing slash character, so $path
and $file
can be concatenated without specifying a slash between the two.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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%2funix.stackexchange.com%2fquestions%2f496212%2fprotect-overwriting-folder-content%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
One might use inotifywait
to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools
.
Create a script, perhaps /usr/local/sbin/inbox.sh
, as follows.
#!/usr/bin/env bash
inotifywait -m -e create "/path/to/directory" |
while read path event file; do
if [ "$event" = "CREATE" ]; then
chown root:root "$path$file"
fi
done
Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh
). Then run it at boot time from, say, /etc/rc.local
or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &
.
According to the manual, -m
monitors indefinitely, and -e
watches for a specific event. Within the while
loop, it could be possible to receive an event such as CREATE,ISDIR
, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if
statement contains a command to respond only to new files, which are represented with the event, CREATE
. The path
variable from inotifywait
has a trailing slash character, so $path
and $file
can be concatenated without specifying a slash between the two.
add a comment |
One might use inotifywait
to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools
.
Create a script, perhaps /usr/local/sbin/inbox.sh
, as follows.
#!/usr/bin/env bash
inotifywait -m -e create "/path/to/directory" |
while read path event file; do
if [ "$event" = "CREATE" ]; then
chown root:root "$path$file"
fi
done
Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh
). Then run it at boot time from, say, /etc/rc.local
or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &
.
According to the manual, -m
monitors indefinitely, and -e
watches for a specific event. Within the while
loop, it could be possible to receive an event such as CREATE,ISDIR
, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if
statement contains a command to respond only to new files, which are represented with the event, CREATE
. The path
variable from inotifywait
has a trailing slash character, so $path
and $file
can be concatenated without specifying a slash between the two.
add a comment |
One might use inotifywait
to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools
.
Create a script, perhaps /usr/local/sbin/inbox.sh
, as follows.
#!/usr/bin/env bash
inotifywait -m -e create "/path/to/directory" |
while read path event file; do
if [ "$event" = "CREATE" ]; then
chown root:root "$path$file"
fi
done
Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh
). Then run it at boot time from, say, /etc/rc.local
or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &
.
According to the manual, -m
monitors indefinitely, and -e
watches for a specific event. Within the while
loop, it could be possible to receive an event such as CREATE,ISDIR
, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if
statement contains a command to respond only to new files, which are represented with the event, CREATE
. The path
variable from inotifywait
has a trailing slash character, so $path
and $file
can be concatenated without specifying a slash between the two.
One might use inotifywait
to watch the directory and make changes, such as changing ownership of each new file copied into the directory. In a Debian-based distribution, install the software as follows: apt-get install inotify-tools
.
Create a script, perhaps /usr/local/sbin/inbox.sh
, as follows.
#!/usr/bin/env bash
inotifywait -m -e create "/path/to/directory" |
while read path event file; do
if [ "$event" = "CREATE" ]; then
chown root:root "$path$file"
fi
done
Give the script permission to execute (chmod 0700 /usr/local/sbin/inbox.sh
). Then run it at boot time from, say, /etc/rc.local
or whichever RC file is appropriate: /usr/local/sbin/inbox.sh &
.
According to the manual, -m
monitors indefinitely, and -e
watches for a specific event. Within the while
loop, it could be possible to receive an event such as CREATE,ISDIR
, which indicates the creation of a directory, of course. Directories are not the target of the question; thus the if
statement contains a command to respond only to new files, which are represented with the event, CREATE
. The path
variable from inotifywait
has a trailing slash character, so $path
and $file
can be concatenated without specifying a slash between the two.
edited Jan 23 at 20:07
answered Jan 23 at 16:44
ChristopherChristopher
10.4k33148
10.4k33148
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f496212%2fprotect-overwriting-folder-content%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
Also not allowed to edit/delete own files ? I don't think that is possible. The owner of a file could always change its permissions.
– RoVo
Jan 23 at 13:40