Command: ssh user@testhost "sudo -u tester env PERL5LIB=/home/tester/perl5/lib/perl5 /home/tester/perl5/bin/testperl"

Result: Can't locate testperl.pm: Permission denied at /home/mogile/perl5/bin/testperl line 15.

How can I fix the problem?

1 Answer 1


The problem is that perl @INC contains dot (current directory), but the current directory (ssher's home directory) cannot be accessed by the executor tester, so the perl interpreter complains about it.

The solution: ask sudo use bash login session, i.e., sudo -i -u tester env PERL5LIB=/home/tester/perl5/lib/perl5 /home/tester/perl5/bin/testperl, then the current directory will be tester's home directory and sure he has the permission to access it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.