Results 1 to 8 of 8

Thread: CRON for File Permissions

  1. #1
    Senior Member
    Join Date
    Mar 2004
    Location
    California
    Posts
    724

    Default CRON for File Permissions

    I have a photo posting script that sometimes does not give the right permissions to photos, and they cannot be seen. The fix is easy enough; I go in and change the permissions to 644, and all is well. But it takes manual intervention.

    I'm wondering if there's a way to make a cron job that I run weekly to change the file permissions of all files in a specific directory to rw-r--r-- I'm just not sure of the syntax that would take ... something like "chmod rw-r--r-- home/public_html/directory/*.*" perhaps?

  2. #2
    Member
    Join Date
    Mar 2004
    Location
    India
    Posts
    78

    Default

    Would be better if you pass in the complete path:
    Code:
    /bin/chmod -R 644 /home/<insert_user_name>/public_html/<directory_name>
    or for a single file

    Code:
    /bin/chmod 644 /home/<insert_user_name>/public_html/<directory_name>/<file_name>

  3. #3
    Senior Member
    Join Date
    Mar 2004
    Location
    California
    Posts
    724

    Default

    I logged into a ssh session using Putty, and tried using:

    /bin/chmod -R 644 /home/<myusername>/public_html/<directory>

    to test the syntax out. While it lists all the files, it gives a "permission denied" message on each one, so it doesn't change the permissions. Not sure why this is happening; I know the username is correct, as I'm logged in under it.

  4. #4
    Senior Member
    Join Date
    Mar 2004
    Location
    California
    Posts
    724

    Default

    Anyone know why this won't work from a SSH login?

    Code:
    /bin/chmod -R 644 /home/<insert_user_name>/public_html/<directory_name>
    I don't want to set up a cron job with something I haven't verfied (been there, done that, learned what "suspended" means when the script went berserk!)

    Am I missing /usr/ in front or something?

  5. #5
    Administrator AndrewT's Avatar
    Join Date
    Mar 2004
    Location
    Tulsa, OK
    Posts
    3,637

    Default

    Is it reporting an error or anything? That should work just fine.

  6. #6
    Senior Member
    Join Date
    Mar 2004
    Location
    California
    Posts
    724

    Default

    Yep, its giving me a "failed to get attributes of" message, lists the file in the directory, and then has a "permission denied" message. It lists each of the files in the directory, so I know its finding them.

  7. #7
    Administrator AndrewT's Avatar
    Join Date
    Mar 2004
    Location
    Tulsa, OK
    Posts
    3,637

    Default

    Submit a trouble ticket with the exact command you are trying to run along with your SSH user/pass.

  8. #8
    Senior Member
    Join Date
    Mar 2004
    Location
    California
    Posts
    724

    Default

    As usual, the problem was quickly solved with a trouble ticket. Actually, the easy part was. My command string should have had an asterik on the end of it:

    Code:
    NOT:
    /bin/chmod -R 644 /home/<insert_user_name>/public_html/<directory_name>
    
    But this format:
    /bin/chmod -R 644 /home/<insert_user_name>/public_html/<directory_name>/*
    The command still has trouble because of the number of files in the directory. I'll have to look at the script and see if I can move some of the files without manually editing the 2000 image paths!

    The script I'm using is Photopost, and it has to be the worst script, especially since I paid the most for it, and the authors are less than helpful. I would love it if I could convert the pics to Goldmine. I may have to do that manually.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •