AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
Expand all | Collapse all

Incorrect permissions for a file

  • 1.  Incorrect permissions for a file

    Posted Fri April 08, 2011 12:47 AM

    Originally posted by: SystemAdmin


    Hi all,

    I am facing a problem currently, with incorrect permissions being set on a file that is being generated automatically.
    There is a cronjob which runs for an id uvstart, at 12:30 am ET which generates this file on a particular directory. When the file is generated, it has the permissions of 660. This file is being read by an interfacing application, which SFTPs to my server and picks this file. The permission on the file has to be 666 for the interfacing application to read it. For the past 3 days I log in at 12:30 and manually change the permissions.
    The other things which I have tried are:
    1) I added a ;chmod 666 <path name> after the entry in the cron job - it did not work
    2)I changed the File creation umask for the id uvstart from smitty - that also apparently did not work.

    Can someone please help me as to how to fix the permission for the file that gets created(each day a new one) on that particular directory, to be 666

    Thanks in advance,

    GG


  • 2.  Re: Incorrect permissions for a file

    Posted Fri April 08, 2011 09:09 AM

    Originally posted by: orphy


    Is the cronjob that creates the file a script? If so, try putting "umask 000" at the beginning of the script but I don't see, from your descriptions, the need for 666. I think a "umask 002" is good enough. If it's not a script, try putting the line in a script with the umask added and run the script in cron to see how that works. You don't have to wait until late night to try it. You can just try it with a simple "touch <dir>/testfile" in the script and see if the perms are good.

    Did chmod 666 in cron get you an error? If you didn't send the chmod output to a file, check the emails of user uvstart.

    Depending on your security requirements, you might also add the group of the directory to the group set of the interfacing application and make sure the directory has SGID (chmod g+s <dir_name>) and it would still be able to read the file with 660 perm.

    If these don't work, show us some more info and see if we could figure it out.

    cron entries
    lsuser uvstart
    lsuser <id running the int. app>
    ls -ald <directory>
    ls -al <file generated>
    Orphy