J
J
Jammarra2012-03-30 10:02:27
linux
Jammarra, 2012-03-30 10:02:27

Prevent deleting files in a folder?

Hello, how can I use chmod to prevent deleting and editing files in a folder, but at the same time leave the ability to upload new files to all users?

Answer the question

In order to leave comments, you need to log in

7 answer(s)
@
@sledopit, 2012-03-30
_

chmod is no help here: if you have write permissions to the directory, then even chmod 000 will not save you from deletion. Chattr + i on the file
can help you . Then even root will not be able to delete the file until it removes this attribute (chattr -i).

A
Andrew, 2012-03-30
@Morfi

hmm, in windows this is very easy to do, with simple permissions settings as a folder.
Is it really that hard in Links?

E
Eddy_Em, 2012-03-30
@Eddy_Em

chmod a + t on the directory will save you from deleting a file uploaded by another user (chattr + i does not work on all file systems, in reiserfs, for example, this is not the case). However, if the file has 666 permissions, everyone will be able to change the contents of the file (although they won't be able to delete it).

B
BrainHacker, 2012-03-30
@BrainHacker

First change the owner of these files via chown (for example, to root'a). And then put chmod 744 on them. Should help

E
egorinsk, 2012-03-30
@egorinsk

See the chmod manual for how /tmp is organized. There is some kind of flag that is put on the folder and allows only the owner of the file to delete files.

I
intr, 2012-03-30
@intr

If we are talking about FTP, then this can be done on proftpd. Limits can be set on any ftp command for any user. I did this configuration. Users uploaded files to ftp for moderator review. Once the file is written, nothing can be done with it. The config file got lost years ago, but it wasn't hard to find there. Here Here , all FTP commands Here .

M
Mr Jenkins, 2015-06-23
@qassarb

For example, you have a directory:
We need to make sure that the client cannot delete the inbound directory, but can delete files from it.
I propose the following:

chmod 555 /home/user/ftp/test/
chmod 777 /home/user/ftp/test/*

Thus, we protected the catalog from demolition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question