我正在尝试通过模块http://search.cpan.org/~salva/Net-OpenSSH-0.62/创建一个ssh句柄。我尝试将GSSAPIAuthentication
和GSSAPIDelegateCredentials
设置为"否",但是如果我的.ssh/config
是这样的话,这些设置就不会生效:
$ cat myusername/.ssh/config
Host *
CheckHostIP no
StrictHostKeyChecking no
HashKnownHosts no
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
UserKnownHostsFile /dev/null
LogLevel ERROR
这是我尝试设置GSSAPIAuthentication
和GSSAPIDelegateCredentials
的方法。还有一种方法可以在open ssh构造函数中给出-F
选项,这样默认情况下ssh使用其他配置文件而不是使用一个用户我的用户名吗?
$self->{ssh} = Net::OpenSSH->new($host,
user => $username,
passwd => $password,
timeout => $timeout,
default_stderr_discard => 1,
kill_ssh_on_timeout => 1,
master_opts => [-o => "UserKnownHostsFile=/dev/null",
-o => "GSSAPIAuthentication=no",
-o => "GSSAPIDelegateCredentials=no",
-o => "StrictHostKeyChecking=no"]);
答案 0 :(得分:-1)
只需添加-F => ' somepath /配置'在master_opts下:
master_opts => [-F => ' somepath /配置']
和另一行如下:
$ self-> {ssh} - > {_ ssh_opts} = [' -F',' somepath / config'];'