从 Bash 进行 Remmina RDP 连接,无需加密密码或创建配置文件?

从 Bash 进行 Remmina RDP 连接,无需加密密码或创建配置文件?

如何使用 Remmina 通过 RDP 连接到计算机?我明白我可以这样做:

remmina -c "rdp://[email protected]"

但随后我必须输入我不想做的密码。

Remmina 似乎也支持这种格式:

remmina -c rdp://username:encrypted-password@server

但我的 Bash 脚本需要完全自动化,而且我找不到无需交互即可加密密码的方法。除此之外,密码加密似乎依赖于其他系统服务,我什至不确定这些服务是否一定可用。当我remmina --encrypt-password第一次运行时,它只打印以下消息:

Load modules from /usr/lib64/remmina/plugins
Remmina plugin glibsecret (type=Secret) has been registered, but is not yet initialized/activated. The initialization order is 2000.
The glibsecret secret plugin  has been initialized and it will be your default secret plugin

而不是让密码加密。

我还想避免为此生成个人资料。

顺便说一句,加密密码对我没有任何好处,因为这只是为了与不重要的虚拟机进行本地连接。我使用密码的唯一原因是 Windows 不允许无密码 RDP。

编辑:

到目前为止我能想到的最好的办法是:

RDP_USER=Administrator
RDP_PASSWORD=admin
RDP_HOST=192.168.122.2

# Run it once because the first time it prints a useless message instead of actually encrypting
echo "$RDP_PASSWORD" | remmina --encrypt-password &>/dev/null

# Run it again, hoping it always works the second time
ENCRYPTED_PASSWORD="$(echo "$RDP_PASSWORD" | remmina --encrypt-password | grep 'Encrypted password: ' | cut -d':' -f2- | tr -d ' ')"

remmina -c "rdp://${RDP_USER}:${ENCRYPTED_PASSWORD}@${RDP_HOST}"

答案1

Remmina 使用 DBUS 与其他实例进行通信,这些实例根据您的描述运行(检查应用程序托盘)。尝试在单独的会话中运行它:

dbus-run-session remmina --encrypt-password <<< "password"

甚至与 DBUS 断开连接:

DBUS_SESSION_BUS_ADDRESS= remmina --encrypt-password <<< "password"

您也可以使用 openssl 来完成此操作,而无需运行图形环境。看这个答案

相关内容