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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .