我创build了一个configuration脚本,可以帮助我在每次启动盒子时在我的stream浪盒子(Ubuntu 14.04 LTS)中创build一个到远程机器的SSH隧道。
我的Vagrantfile有趣的部分:
config.ssh.forward_agent = true config.vm.provision :shell, path: "setuptunnel.sh", run: "always", privileged: false
和setuptunnel.sh文件:
#!/usr/bin/env bash ssh -o StrictHostKeyChecking=no -NL 5432:localhost:5432 me@remotemachine &> /tmp/sshtunnel.log & if [ $? -eq 0 ]; then echo "successfully created ssh tunnel." else echo "error creating ssh tunnel." fi
但是当我走进stream浪汉的时候,隧道并没有被创造出来。 调查/tmp/sshtunnel.log显示我:
Warning: Permanently added 'remotemachine,1.2.3.4.5' (ECDSA) to the list of known hosts. Permission denied (publickey).
手动运行ssh-command成功build立隧道。 所以看起来好像代理转发在预configuration运行时不起作用?