Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running a game server (ut2004) on Centos 6. It creates demos, logs and other stuff which I need to process later with other applications. But the problem is - all these files have 0600 permission by default, while I need it to be 0755.

Is there a way to fix it?

Thanks!

share|improve this question

migrated from stackoverflow.com Aug 9 '13 at 15:16

This question came from our site for professional and enthusiast programmers.

2 Answers 2

You can use umask for this:

$ umask 100
$ touch d
$ ls -l d
-rw-rw-rw-  1 hashier  staff  0 Aug  9 16:20 d
$ umask 022
$ touch f
$ ls -l f
-rw-r--r--  1 hashier  staff  0 Aug  9 16:20 f

So what you want is set

umask 022

It is reset in every new login shell, so you might want to set it in your .bashrc or .zshrc or whatever you use.

share|improve this answer
    
Thanks for the answer! I checked the current umask for my user and it has already been 022. Even changing it to 000 in bashrc gave no effect too - files I create have the right permissions, but the game server (which I restarted ofc) still creates files with 0600 permissions. Seems like it's process doesn't inherit umask from me (root). Am I doing anything wrong? –  Dragonheart Aug 9 '13 at 17:55
    
Have you checked /etc/fstab. It's just a guess but maybe the umask gets set there and maybe this takes precedence. If you run mount you can see the options with which the partition is mounted. –  hashier Aug 10 '13 at 11:05
    
And wait... you and root are two different users? First: don't run the game server as root. Second: don't use root as your default user! NEVER! Third: umask set as a user and not in /etc/fstab is something per user. You can try to set it in the startup script for the game server but once again do NOT run the game server as root. –  hashier Aug 10 '13 at 11:07

Or you might want to try another way

$touch file
$chmod 755 file

Are you in control of the process that creates the files? Then add the second line below. :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.