Re: File owner mode

 
SOLVED
Go to solution
heaman1
Regular Advisor

File owner mode

I have a file in my server , many user will update this file and change the mode , can advise if I want the file mode is keep to "666" even it have been updated by user , what can i do ?

p.s. what I do is run a crontab job chmod 66 my_file , except this method , what can i do ? thx
4 REPLIES 4
prasadb
Super Advisor
Solution

Re: File owner mode

hi heaman1,

>if I want the file mode is keep to "666" even it have been updated by user , what can i do ?

if you set the permission 666 (4+2), 4 stands for READ permission and 2 for WRITE permissions, that means you have given write permissions to the Owner, group and everybody else for that file.

if you dont want to permit group members as well as others, remove write permissions by simply

#chmod g-w,o-w

OR
#chmod 644

go for "man chmod" for more info.


WR,
prasad

Vinoyee Madashery Poulo
Frequent Advisor

Re: File owner mode


I think the same user id is shared by the many people. The file permission can be changed by owner of the file or by root user. If you are sharing the same user id with many people then change the ownership of this file to root or some other user. As long as a file has 666, it is possible to write on to this file by any user. Remember that when you grant write permission to all, any body can delete it.
Avinash20
Honored Contributor

Re: File owner mode

Heaman: "many user will update this file and change the mode"

You may need to find why they are changing the permission of the file. You could restrict this.

It might be easy if you could write a script in the application itself to ask a warning to the user to change the permission to 666 once they are done with their jobs.

NOTE: The users are changing permission for some specific reason and you changing the permission again to 666 might well be like "user not changing the permission"
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Dennis Handly
Acclaimed Contributor

Re: File owner mode

>vinoyee: Remember that when you grant write permission to all, anybody can delete it.

That's incorrect, you can't remove the file unless the directory is writable but you can delete the contents.

>Avinash: You may need to find why they are changing the permission of the file.

Possibly the editor or the tool is recreating the file vs overwriting it?