从Perl执行Shell脚本时权限被拒绝

时间:2020-03-09 09:50:56

标签: bash shell perl permissions

从perl执行shell脚本时,权限出现问题。 在没有perl的情况下执行shell脚本时不会出现问题。

#!/usr/bin/perl

use Getopt::Long;

my $server = "remoteServer";

my $i_login ='';
my $i_kont ='';

GetOptions (
        "--login|l=s" => \$i_login,
        "--kont|k=s" =>\$i_kont
                );

if(!$i_login || !$i_kont)
{
         print "Not required parameters\n";
         exit 1;
}

my $kont = "pathToScript/script/script.sh";

if ($i_kont eq "run")
{
        system('ssh', $server, $kont, '-m', $i_login);
}
else
{
print "run kont manually\n";
}

tee:script_2020-03-09-10:24:27.log:权限被拒绝

两个脚本都具有-rwxrwxr-x权限。

1 个答案:

答案 0 :(得分:0)

已解决。 当我从ssh执行脚本时,它不会读取配置文件。 我在$ kont =“ pathToScript / script / script.sh”中添加了一行,以便在开始时读取配置文件,现在可以正常使用了。