有没有人见过这个?请注意,这不仅发生在 google.com 上,而且发生在我尝试的每个域中。这是一个无线连接 (WEP),但我不确定这有什么关系:
$ curl -v google.com
# This takes about 60s to return
* getaddrinfo(3) failed for google.com:80
* Couldn't resolve host 'google.com'
* Closing connection #0
curl: (6) Couldn't resolve host 'google.com'
$ wget google.com
--2011-11-28 14:44:08-- http://google.com/
Resolving google.com... failed: Name or service not known.
wget: unable to resolve host address `google.com'
$ ping google.com
PING google.com (209.85.148.147) 56(84) bytes of data.
64 bytes from fra07s07-in-f147.1e100.net (209.85.148.147): icmp_req=2 ttl=54 time=136 ms
64 bytes from fra07s07-in-f147.1e100.net (209.85.148.147): …Run Code Online (Sandbox Code Playgroud) 我以前曾经工作过一次,但由于某种原因它无法在我的新系统上工作。
我有.kde4/Autostart/一个名为 ssh-agent 的符号链接01-sshagent,然后是一个名为的简单脚本02-sshkeys,如下所示:
/usr/bin/ssh-add $(find $HOME/.ssh/keys -type f | egrep -v '\.pub$')
Run Code Online (Sandbox Code Playgroud)
问题似乎是,当我启动时,ssh-agent 运行正常,但 KDE 不会保留输出并将其存储在环境中,因此对于每个 Konsole 会话,我必须运行以ps查找 PID,然后手动类型:
SSH_AUTH_SOCK=/tmp/ssh-YtvdiEtW3065/agent.3065; export SSH_AUTH_SOCK;
SSH_AGENT_PID=<pidnumber>; export SSH_AGENT_PID;
Run Code Online (Sandbox Code Playgroud)
...只是为了让它工作,它确实...就在那个 Konsole 窗口中。
我尝试删除上述符号链接,并让 ssh 脚本看起来像这样:
/usr/bin/ssh-agent | sh
/usr/bin/ssh-add $(find $HOME/.ssh/keys -type f | egrep -v '\.pub$')
Run Code Online (Sandbox Code Playgroud)
但是,代理变量并不在会话中,并且从未提示我输入密钥的密码。
我显然错过了一些东西,但它是什么?
我知道如何让用户使用密钥 ssh 进入另一个盒子:
ssh -l targetuser -i path/to/key targethost
Run Code Online (Sandbox Code Playgroud)
但是非帐户用户喜欢什么呢apache?由于该用户没有可以写入.ssh目录的主目录,因此整个事情一直失败:
$ sudo -u apache ssh -o StrictHostKeyChecking=no -l targetuser -i path/to/key targethost
Could not create directory '/var/www/.ssh'.
Warning: Permanently added '<hostname>' (RSA) to the list of known hosts.
Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)
我尝试过使用-o UserKnownHostsFile=/dev/null和设置$HOMEto 的变体/dev/null,但这些都没有达到目的。我知道这sudo可能会为我解决这个问题,但我试图避免需要手动服务器配置,因为此代码将部署在许多不同的环境上。
有任何想法吗?
以下是我尝试过但不起作用的一些示例:
$ sudo -u apache export HOME=path/to/apache/writable/dir/ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=path/to/apache/writable/dir/.ssh/known_hosts -l deploy -i path/to/key targethost
$ sudo -u apache ssh -o …Run Code Online (Sandbox Code Playgroud)