Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi!

On a CentOs box, a perl script creates some files, and chmod them 0666. Then these files are used by the ..users, and modified by other perl scripts.

I noticed that some of these files, from time to time, are set back to chmod 0644 and am unable to see what causes it. None of the scripts that are used, do this.

Any suggestion?

Thank you

Replies are listed 'Best First'.
Re: File permission
by slacker (Friar) on Mar 13, 2009 at 21:34 UTC
    Are these files being purged and recreated?
    This may have to do with the default umask of whatever is creating these files.
    Assuming you are using bash as the default shell, check the umask setting in /etc/bashrc.
    For information on umasks reference this page.
    umasks
Re: File permission
by natol44 (Sexton) on Mar 13, 2009 at 20:17 UTC
    Sorry, forgot to login :-(

    Hi!

    On a CentOs box, a perl script creates some files, and chmod them 0666. Then these files are used by the ..users, and modified by other perl scripts.

    I noticed that some of these files, from time to time, are set back to chmod 0644 and am unable to see what causes it. None of the scripts that are used, do this.

    Any suggestion?

    Thank you

      Some editors create a new file rather than overwriting an existing file. Once the new file is written, the old file is replaced with the new file. This prevents information loss in the event of an error.

      This could account for a change in permission. You can verify if this is happening by comparing the inode number of the file before and after the permission change.