【发布时间】:2013-10-16 18:45:35
【问题描述】:
use Net::SSH::Any;
use Data::Dumper;
# my $ssh2 = Net::SSH::Any->new(..);
my $cmd = "sudo -u postgres -p password perl -e 'print `whoami`'";
print Dumper $ssh2->capture({timeout => 15}, $cmd);
我想在远程主机上sudo,但不喜欢在命令行上像上面的代码那样使用纯密码。有其他选择吗?
【问题讨论】:
-
password-less sudo(当然有安全隐患)
-
@ThisSuitIsBlackNot tnx,但我无法更改 sudo 行为
-
还有
-S开关,看起来很有前途? superuser.com/a/67766/223664