Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Changin file premissions -perl/cgi

  • 15-02-2005 11:54pm
    #1
    Registered Users, Registered Users 2 Posts: 2,934 ✭✭✭


    HI
    Im using the following line to change a files permissions from
    644 to 646

    No success - any suggestions

    chmod 0646, $open_file or
    die "couldn't chmod $fopen_file to 0646";

    I can't seem to change to anything


Comments

  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    Does it work if you try it via FTP or SSH?


  • Registered Users, Registered Users 2 Posts: 2,934 ✭✭✭egan007


    Yeah - i'm ftp'd to the site (cute) and i can change it to any permissions


  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    Are you even getting any error messages on screen or in logs?


  • Registered Users, Registered Users 2 Posts: 6,571 ✭✭✭daymobrew


    Add '$!' to the end of the die message to get the system error message.

    chmod 0646, $open_file or
    die "couldn't chmod $fopen_file to 0646: $!";

    Is $open_file the path to the file or a file handle (returned by open function?, it should be the file path).


  • Registered Users, Registered Users 2 Posts: 2,934 ✭✭✭egan007


    - no errors thrown up
    - $open_file is the file path
    I have found a way around it anyway so cheers for the help.


  • Advertisement
  • Closed Accounts Posts: 304 ✭✭Zaltais


    I know you say you found a way around it but the problem probably is this:

    The user that is trying to change the permissions on the file doesn't have the required permission level itself.

    Most apache servers are set up to run as the user 'nobody' or as a user set up just to run the webserver itself (e.g. 'httpd' on RedHat/Fedora or 'www-data' on Debian) if the file is created as '0644' by the root user (for example) then the apache user (which cgi scripts are run as) doesn't have write access to the file, and so can't change it's permissions.

    There's a couple of ways around this, but most of them are potentially insecure, so your 'way around it' may actually be the best course of action anyway.


  • Closed Accounts Posts: 2,525 ✭✭✭JustHalf


    Do you need to change the permissions via this script? Is it possible to change them just using your FTP client?

    I'm pretty sure you can get Perl to report the user it is running the script as... this should help in your debugging. This is a *nix machine, right?

    BTW, a chmod 646 will make your files world-writable. Is this acceptable to you? If it's on a public server, this usually isn't a very good idea.


Advertisement