1834481 Members
3737 Online
110067 Solutions
New Discussion

File permissions

 
SOLVED
Go to solution
Verónica Muñoz Segovia
Frequent Advisor

File permissions

Hi everybody,

I'm trying to restrict some files permissions to an account on my system. But I even deny all the permissions to the files and the user can delete them. For example:

I have the file hola.txt without any kind of permissions (000), and when the user type rm hola.txt, I have the follow message:

hola.txt: 0 mode ? (y/n)

And if the user pulse y, he can delete the file, somebody could tell me why? and how can I avoid this? The only permisson that he could have is the execute permisson.

Thank you.
Always is important to know the opinion of other people with or without experience
3 REPLIES 3
Jitendra_1
Trusted Contributor
Solution

Re: File permissions

Thats perfectly normal. The file with 000 permission can be removed as long as the directory has write permissions for that user. Tighten your directory permissions to something like 755.
Learning is the Key!
James R. Ferguson
Acclaimed Contributor

Re: File permissions

Veronica:

If the sticky bit is set on the directory, then users can only remove files for which they have explicit write permission as the owner. 'root', of course, can remove anything.

A directory with the sticky bit set will look like "dXXXXXXXXt" -- note the "t".

For instance, to set the sticky bit on /xxx, do:

# ls -l /xxx #...gives drwxr-xr-x
# chmod 1755 /xxx
# ls -l /xxx #...shows drwxr-xr-t

See the man pages for 'chmod'.

...JRF...
Verónica Muñoz Segovia
Frequent Advisor

Re: File permissions

Thank you for the answers, this is what I did,
I change the owner of the user directory, now the will cannot delete any file.

Veronica
Always is important to know the opinion of other people with or without experience