-2

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?

petertc
  • 2,500
  • 1
  • 15
  • 10

1 Answers1

0

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.

petertc
  • 2,500
  • 1
  • 15
  • 10