www.webdeveloper.com
Results 1 to 2 of 2

Thread: Running Perl Script as Root

  1. #1
    Join Date
    Apr 2008
    Posts
    171

    Running Perl Script as Root

    I am trying to create a flat text file above the web document root directory and save a few lines of text. Given my web user ("nobody") does not have directory permissions to this location, I am looking to run a basic script that can create a file and add a few lines of text.

    Is it possible to do this in a Perl script? I have had no success with PHP (see http://www.webdeveloper.com/forum/sh...d.php?t=224375).

    Has anyone ever done this? Do you have a sample of the perl script?

    Thanks again.

  2. #2
    Join Date
    Oct 2007
    Location
    Vienna, Austria
    Posts
    393
    This is not the best way to go, methinks. If you actually can get root permissions, then rather give your www user proper permissions.

    For example, you could create a new group "powerusers", assign the directory to that group, give it the group-write permission and add your web user to this group.

    Code:
    su root
    groupadd powerusers
    chgrp powerusers /var/www/.../
    usermod -G powerusers nobody
    chmod g+w /var/www/.../
    exit
    HTH!

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
  •  
HTML5 Development Center



Recent Articles