Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Yesterday, I have installed PERL 5.20.2 as root in

/usr/local/bin/perl-5.20.2

The libraries and modules have been correctly installed in

/usr/local/bin/perl-5.20.2/lib/

Directories of /usr/local/bin have to my view correct permission settings 755 and the modules have to my view correct permission settings 644.

I switched then the user to "daily_work" and tried to execute a PERL script which makes use of libraries and modules.

I obtained the error message "Permission denied" for all the libraries and modules used.

I tried then to add a line

use lib '/usr/local/bin/perl-5.20.2/lib' ;

but the interpreter remained stubborn and wrote

lib.pm "Permission denied"

In the FileBrowser all libraries and modules were "locked" but there was no job visible with "top" which could have locked PERL modules. A system restart removing potential remainings of the "make install" didn't improve anything.

After a re-installation of PERL and some necessary modules from CPAN I tried to excute the same PERL script as root and the result was 100% correct and no error message appeared. Unfortunately, this does not mean anything on my LINUX machine - root is the king and has all permissions.

I tried then to print @INC in order to find out the paths to be checked for permissions:

for ($i=0; $i<scalar(@INC); ++$i) { print $INC[$i]."\n"; } print "end of vector INC \n\n";

The output was:

/root/localperl/lib/site_perl/5.20.2/x86_64-linux

/root/localperl/lib/site_perl/5.20.2

/root/localperl/lib/5.20.2/x86_64-linux

/root/localperl/lib/5.20.2

.

end of vector INC

In former versions of PERL there had been at least an @INC entry looking like

/usr/local/bin/perl-5.20.2/lib/

Now the questions are:

a) How can I (and most likely many other PERL programmers) fix that as normal users when lib.pm is "locked" by root's home?

b) How can I install PERL in such a way that all users have access to the libraries and modules?

With kind regards

mvi

  • Comment on LINUX PERL 5.20.2 libraries and modules: "Permission denied" for all users except root
  • Select or Download Code

Replies are listed 'Best First'.
Re: LINUX PERL 5.20.2 libraries and modules: "Permission denied" for all users except root
by Anonymous Monk on Mar 01, 2015 at 21:41 UTC

    I tried then to print @INC in order to find out the paths to be checked for permissions:

    So what were the permissions? ls -loanh ...

    a) How can I (and most likely many other PERL programmers) fix that as normal users when lib.pm is "locked" by root's home?

    You cannot fix permission issues without root

    b) How can I install PERL in such a way that all users have access to the libraries and modules?

    How did you install, did you save your install log?

Re: LINUX PERL 5.20.2 libraries and modules: "Permission denied" for all users except root
by kroach (Pilgrim) on Mar 01, 2015 at 22:53 UTC
    How did you install Perl?
    Also, consider perlbrew for installing and managing different versions of Perl.

      Many thanks kroach. I had overlooked the detail that there are indeed several ways to install PERL.

      Yesterday, I had configured the installation as recommended on http://www.cpan.org/src/README.html :

      tar -xzf perl-5.20.2.tar.gz cd perl-5.20.2 ./Configure -des -Dprefix=$HOME/localperl make make test make install

      As I recognize now the -Dprefix=$HOME/localperl makes essentially a "personalized" version of PERL for the installing user. In my case this user is root - that explains the problem of the other users and the entries in @INC.

      Today, I configured as recommended in the INSTALL help and without a prefix:

      tar -xzf perl-5.20.2.tar.gz cd perl-5.20.2 sh Configure -de make make test make install

      Now everything works fine for all users and the entries in @INC are ok!

      With many thanks and kind regards

      mvi