#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2017
    Location
    Minnesota, USA
    Posts
    3
    Rep Power
    0

    Question An odd CPAN issue...


    A bit of background: I use NFS automounts for home directories, with root-squashed. I have cloud systems which use this configuration.

    As an alternative to giving the users full root authority, I've written a program to do certain software installs for them. This program has the setuid bit set so that the program runs as root. This works great as a front-end to yum and several other commands, but I'm having a problem with CPAN. Specifically, the cpan command attempts to create the directory $HOME/.local in the user's directory. But, since root is squashed, it has no access to the directory, and the command fails.

    ./cloudSoftware cpan foobar
    mkdir /home/auto/usernamehere/.local: Permission denied at /usr/share/perl5/CPAN/HandleConfig.pm line 589.

    Is there a parameter I can specify for the cpan command which would allow it to use some other base path for its files? I'd like to be able to allow a non-priv'ed user to run cpan for the host, and yet keep the root-squash parameter for the home directory mounts.
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,458
    Rep Power
    1874
    How to reset cpan to default values
    Create your own Config.pm with suitable directories, then invoke cpan -j Config.pm to run cpan with that configuration.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2017
    Location
    Minnesota, USA
    Posts
    3
    Rep Power
    0
    Received an answer on stack overflow: Set the $HOME environment variable to whatever is necessary before running the cpan command, and it will create the .local directory there.

    Comments on this post

    • salem disagrees : Thanks for letting me know I wasted my time because you posted elsewhere
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Apr 2009
    Posts
    2,229
    Rep Power
    1231
    Referenced SO answer: perl - Can cpan's use of the .local directory be redirected? - Stack Overflow

    Comments on this post

    • Will-O-The-Wisp agrees : Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo