在批处理文件中加速 ssh

发布于 2024-08-09 13:29:55 字数 1171 浏览 11 评论 0原文

这是我的情况:
   我有一个带有 Windows 客户端的 Linux 服务器/媒体中心。
   我的目标是远程控制节奏盒等。
   我已经使用 plink(基于 Windows 的 cli ssh 玩具)完成了此操作。
   问题是启动 ssh 会话登录并发送命令的速度非常慢,这是可以理解的。当我有 Windows 服务器时,我使用了一个名为 psexec 的工具,它几乎是即时的。

   有什么办法可以加快这个过程吗?要么以某种方式发送带有登录请求的命令,这应该会显示出一些改进。或者通过维护我可以使用的持久 ssh 连接。 (在命令末尾 plink dcs)。

更多信息:
在我的 Windows 机器上,我使用像这样的蝙蝠:
plink -ssh -l 用户名 -pw pass myipaddress "/home/username/bin/skip"

在我的 Linux 机器上,跳过 bash 文件类似于:
//需要解决因通过 ssh 控制韵律盒而导致的 x11 错误
如果它是 ssh 连接
 复制 dbus 地址
fi
rhythmbox-client --next //rhythmbox 的 cli 包装器


进一步研究:
   唯一的方法似乎是保持 ssh 连接作为服务打开/维护。这似乎是可行的,因为由于设置 ssh 隧道(以绕过防火墙)而存在需求。从那里我需要一种方法将命令行命令发送到此现有连接或 重用该连接。
   另一种选择当然是不使用 ssh。天哪,我已经通过 samba 文件共享建立了连接,而且没有任何延迟。我打赌我可以在 Linux 端放置一个服务来检查修改的文件。然后有一个 ap 客户端来修改所述文件。令人惊讶的是,但到目前为止,它似乎是最好的选择。我所说的“最好”是指唯一可以减少控制滞后的方法。一定有比这更好的方法,我不可能是唯一一个使用 Linux 作为媒体中心并需要远程控制的书呆子。这种方式将主题从 stackoverflow 转移到了超级用户,但这没关系。

This is my situation:
    I have a linux server/media center with a windows client.
    My goal is to remote control rhythmbox amongst other things.
    I've done this using plink (windows based cli ssh toy).
    The problem is that starting up an ssh session logging in and sending a command is understandably slow as hell. When I had a windows server I used a tool called psexec which was almost instantaneous.

    Is there any way to speed this process up? Either somehow sending the commands with the login request which should show some improvement. Or by maintaining a persistent ssh connection which I can use. (plink dcs at the end of the command).

More info:
On my windows machine I'm using a bat like:
plink -ssh -l username -pw pass myipaddress "/home/username/bin/skip"

On my linux machine the skip bash file is something like:
//needed to get around a x11 error caused by controlling rhythmbox over ssh
if its an ssh connection
   copy the dbusaddress
fi
rhythmbox-client --next //the cli wrapper for rhythmbox

Further Research:
    The only way to go seems to keep an ssh connection open/maintained as a service. This seems doable as there is a demand due to setting up ssh tunnels (to bypass firewalls). From there I'd need a way to send the command line commands to this existing connection or reuse that connection.
    The other option is of course to NOT use ssh. Hell I already have a connection through samba file shares and there is no lag there. I bet I could put a service linux side that checks for a modified file. Then have an ap client side that modifies said file. Amazingly hacky but so far it seems like the best option. And by best I mean the only one that cuts control lag. There has got to be a better way than this, I can't be the only nerd using linux as a media-center that wants remote controls. This kind of moves the topic from stackoverflow to superuser but that's ok.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜点 2024-08-16 13:29:55

您可以使用SSL证书来获取去掉登录部分。或者,自己构建一个小型 HTTP 服务器,它使用“异国情调”端口来控制您的媒体播放器(amarok,顺便说一句,有一个内置)

You could user an SSL certificate to get rid of the login part. Alternatively, build yourself a small HTTP server which uses an "exotic" port for controlling your media player (amarok, btw, has one build-in)

拥有 2024-08-16 13:29:55

切换到类似 mpd 将绕过 ssh 问题,尽管我不能保证更改曲目会更快。

Switching to something like mpd will bypass the ssh issue, although I give no guarantee that changing tracks will be any faster.

阳光①夏 2024-08-16 13:29:55

如果有人好奇,我最终使用 php 实现了一个基于 http 的服务器来在服务器端执行命令。在客户端,我使用curl.exe 来让我拥有漂亮的可点击按钮,而无需网络浏览器的开销。

也很好,因为它允许我实现一个浏览器用户界面,该用户界面非常适合在任何有互联网的计算机(未安装 ssh 的计算机)上使用。并且可以用我的手机作为遥控器,效果非常好(如果我愿意的话,我可以在遥远的国家使用它......)

If anyone is curious, I ended up implementing an http based server with php to execute commands server side. And client side I used curl.exe to allow me to have nice click-able buttons without the overhead of a web-browser.

Also nice since it allowed me to implement an in browser UI which is great to use from any machine with internet, ones that don't have ssh installed. And works wonderfully from my phone as a remote control (which I can use from a country away if I so chose...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文