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?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityThe 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.