I have a centos server that one of my apps creates files in a tmp folder. The files are always created with the permissions r--r--r-- and i need all the new files in this directory to be created with at the least, the permissions rw-rw-rw-.
How can i achieve this?
EDIT Here's my current setup. I've chmod 777 everything in the /page folder. Then when i run something in my app, it creates or modifies files and they are not rw-r--r--.
/page
ls -ald
drwxrwsrwx 2 tomstest psacln 12288 Aug 2 20:32 .
/page
ls -al
-rw-r--r-- 1 tomstest psacln 2 Aug 2 20:32 size
-rwxrwxrwx 1 tomstest psacln 5 Jul 20 16:58 version
My app errors I think because of the line that is rw-r--r--.
umask
can help but DON'T do this. Why did you want to give other user the write (w) permission?I think everyone else is doing a great job of providing answers, but there's one wrinkle that hasn't been addressed. You specifically mention that your app has a problem when deleting files, but then focus entirely on the protection mode of the files themselves. You should be aware that the ability to delete a file under Unix isn't dependent on the owner or protection mode of the file itself, but of the ownership and protection mode of the directory the file is in. Don't overlook that when seeking the answer to this question!
Append the command to your ~/.bashrc file to make it permanent.