我使用Ubuntu运行Vagrant,每次尝试连接时都会收到错误(为了便于阅读而重新格式化):
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant
<127.0.0.1> REMOTE_MODULE ping
<127.0.0.1> EXEC ssh -C -tt -vvv -o ControlMaster = auto -o ControlPersist = 60s
-o ForwardAgent = yes -o ControlPath="/home/naruto/.ansible/cp/ansible-ssh-%h-%p-%r"
-o StrictHostKeyChecking=no -o Port=2202
-o IdentityFile="/home/naruto/test/.vagrant/machines/default/virtualbox/private_key"
-o KbdInteractiveAuthentication=no
-o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=vagrant
-o ConnectTimeout=10 127.0.0.1 /bin/sh -c
'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1452294114.84-103845443589966
&& chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1452294114.84-103845443589966
&& echo $HOME/.ansible/tmp/ansible-tmp-1452294114.84-103845443589966'
testserver | FAILED => SSH Error: command-line line 0: missing argument.
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug
output to help diagnose the issue.
这是vagrant ssh-config中的信息:
Host default
HostName 127.0.0.1
User vagrant
Port 2202
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/naruto/test/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
这是Ansible的主机文件:
[example]
testserver
ansible_ssh_host=127.0.0.1
ansible_ssh_port=2202
ansible_ssh_user=vagrant
ansible_ssh_private_key_file=/home/naruto/test/.vagrant/machines/default/virtualbox/private_key
知道这个问题是什么或者如何进一步解决这个问题?感谢。
答案 0 :(得分:1)
ssh -C -tt -vvv -o ControlMaster = auto -o ControlPersist = 60s -o ForwardAgent = yes
这部分是错误的。你不能在选项和参数之间放置空格。您需要以与下面其他选项相同的方式使用它:
ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s
-o ForwardAgent=yes
虽然我不知道它来自哪里。