Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6335993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:57:48+00:00 2026-05-24T18:57:48+00:00

I’m trying to write a small Perl script which creates a directory structure. To

  • 0

I’m trying to write a small Perl script which creates a directory structure. To create the directories, I use the standard module File::Path, as follows:

make_path($directory,
    {
        owner   => 'apache',
        group   => 'apache',
        mode    => 0500
    }
);

When executing the script, the directory is created as wanted and the umask is set as expected, but both owner and group of the file are “root”. This is wrong, but where is the error? No error message is printed or given by the error-parameter.

Thanks in advance,

Jost

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:57:49+00:00Added an answer on May 24, 2026 at 6:57 pm

    I just tried it and got the same outcome as you. I looked at the documentation:

    perldoc File::Path
    

    …and no mention of ‘owner’ option. However, searching the latest version (2.08, AFAICT) documentation, and it’s there. Can you check the version of the module on your system?

    perl -MFile::Path -e 'print $File::Path::VERSION'
    

    If you’re not running 2.08, that might be the problem. I’m attempting to track down the changelog for the module right now, but having difficulty…

    [ Later ]

    OK, so here’s what you want to do:

    #!/usr/bin/perl -w
    
    use strict;
    
    use File::Path qw( make_path );
    
    my $directory = $ARGV[0];
    my $owner = 33;
    
    make_path( $directory, { mode => 0500 } );
    chown 33, 33, $directory;
    

    Ultimately, the last line is the one you want to take note of. You can’t set the owner when you create it with that version of File::Path, but you can change it. The 33 in my example is the UID of the www-data user on my system; clearly, you want to change 33 to something more sensible for your system. Also, you will need to make sure that your script runs with privileges that are capable of doing this. For example, if you run this as a lowly user, it won’t work, but if you run it as root, the chown will work. You might want to find some middle ground there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I used javascript for loading a picture on my website depending on which small
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.