From 634b8957bfbf0ec97a3ca6166545c108086a13c7 Mon Sep 17 00:00:00 2001 From: jennmald Date: Wed, 27 May 2026 09:28:40 -0400 Subject: [PATCH 1/2] remote ssh for the merlin --- src/cditools/remote-scripts/merlin.sh | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/cditools/remote-scripts/merlin.sh diff --git a/src/cditools/remote-scripts/merlin.sh b/src/cditools/remote-scripts/merlin.sh new file mode 100644 index 0000000..5883734 --- /dev/null +++ b/src/cditools/remote-scripts/merlin.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# ---- CONFIGURATION ---- +SSH_HOST="xf09id1-det-ioc2.nsls2.bnl.gov" +WINDOWS_IP="xf09id1-merlin1.nsls2.bnl.gov" + +# Optional: RDP credentials (leave empty to prompt or use GUI client) +RDP_USER="administrator" +#RDP_PASS="your_windows_password" + +echo "Enter your username (for tunnel ssh):" + +read SSH_USER + +# ---- SSH Tunnel ---- +echo "Cleaning up any old tunnels..." +pkill -f "ssh -f -N -L ${LOCAL_PORT}:${WINDOWS_IP}:3389" +echo "Starting SSH tunnel to $WINDOWS_IP via $SSH_HOST..." +ssh -f -N -L ${LOCAL_PORT}:${WINDOWS_IP}:3389 ${SSH_USER}@${SSH_HOST} + +if [ $? -ne 0 ]; then + echo "Failed to create SSH tunnel." + exit 1 +fi + +echo "SSH tunnel established. Connecting to RDP at localhost:${LOCAL_PORT}..." + +# ---- Launch RDP Client ---- +# Using xfreerdp +#xfreerdp /v:localhost:${LOCAL_PORT} /u:${RDP_USER} /p:${RDP_PASS} +clipboard /cert:ignore +echo "Enter the Merlin Windows credential..." +xfreerdp /v:localhost:${LOCAL_PORT} /u:${RDP_USER} /cert:ignore /smart-sizing:1440x1080 + +# Optional: clean up tunnel (use pkill if needed) +echo "Clean up the tunnel" +pkill -f "ssh -f -N -L ${LOCAL_PORT}:${WINDOWS_IP}:3389" \ No newline at end of file From 3867295248d2a8c0bf53e40265259990dbd605c5 Mon Sep 17 00:00:00 2001 From: jennmald Date: Wed, 27 May 2026 09:54:46 -0400 Subject: [PATCH 2/2] format --- src/cditools/remote-scripts/merlin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cditools/remote-scripts/merlin.sh b/src/cditools/remote-scripts/merlin.sh index 5883734..1eee6ce 100644 --- a/src/cditools/remote-scripts/merlin.sh +++ b/src/cditools/remote-scripts/merlin.sh @@ -33,4 +33,4 @@ xfreerdp /v:localhost:${LOCAL_PORT} /u:${RDP_USER} /cert:ignore /smart-sizing:14 # Optional: clean up tunnel (use pkill if needed) echo "Clean up the tunnel" -pkill -f "ssh -f -N -L ${LOCAL_PORT}:${WINDOWS_IP}:3389" \ No newline at end of file +pkill -f "ssh -f -N -L ${LOCAL_PORT}:${WINDOWS_IP}:3389"