AutoSH不接受ssh的日志文件选项
上述命令有效。下面的那个没有AutoSH不接受ssh的日志文件选项,ssh,autossh,Ssh,Autossh,上述命令有效。下面的那个没有 autossh -M 10984 -v -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -R 6889:localhost:22 user@rpi.local 上面说, autossh -M 10984 -E /home/pi/ssh.log -v -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -R 6889:loc
autossh -M 10984 -v -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -R 6889:localhost:22 user@rpi.local
上面说,
autossh -M 10984 -E /home/pi/ssh.log -v -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -R 6889:localhost:22 user@rpi.local
在将日志文件传递给AutoSH时,如何将其指定为SSH选项?这是AutoSH的一个限制。AutoSH源代码包含程序接受的命令行开关列表。该列表显然应该包括所有ssh选项,但不包括“E”: 目前似乎有一些变通办法:
#define OPTION_STRING "M:V1246ab:c:e:fgi:kl:m:no:p:qstvw:xyACD:F:I:MKL:NO:PR:S:TVXY"
...
/*
* We accept all ssh args, and quietly pass them on
* to ssh when we call it.
*/
while ((ch = getopt(argc, argv, OPTION_STRING)) != -1) {
switch(ch) {
case 'M':
...
从AutoSh启动的SSH实例应继承重定向这些选项应该传递到
ssh
。您使用的是什么版本?我使用的是AutoSH 1.4d版。我在1.4e版上也尝试了同样的方法。同样的结果。我只是使用了软件包管理器。我在用树莓皮2做树莓皮。我正在我的笔记本电脑上运行Arch Linux。第一个解决方法是只重定向来自AutoSh的错误,而不是它启动的ssh进程。对吗?当一个进程启动另一个进程时,新进程的正常行为是继承旧进程的标准文件句柄。我自己不使用AutoSh,但它的文档没有描述对ssh子进程的标准错误执行任何特殊操作,因此我希望ssh继承AutoSh的标准错误。你可以试试看会发生什么。
#define OPTION_STRING "M:V1246ab:c:e:fgi:kl:m:no:p:qstvw:xyACD:F:I:MKL:NO:PR:S:TVXY"
...
/*
* We accept all ssh args, and quietly pass them on
* to ssh when we call it.
*/
while ((ch = getopt(argc, argv, OPTION_STRING)) != -1) {
switch(ch) {
case 'M':
...
autossh -M 10984 -v -o ... user@rpi.local 2>>/some/log/file