# How can I change the Open OnDemand SSH port

**URL:** <https://discourse.openondemand.org/t/how-can-i-change-the-open-ondemand-ssh-port/3639>\
**Category:** Get Help\
**Tags:** question\
**Created:** [July 22, 2024, 3:01pm UTC](https://discourse.openondemand.org/t/how-can-i-change-the-open-ondemand-ssh-port/3639 "2024-07-22T15:01:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dai542](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/dai542/32/2669_2.png) [@dai542](https://discourse.openondemand.org/u/dai542)\
**Post date:** [July 22, 2024, 3:01pm UTC](https://discourse.openondemand.org/t/how-can-i-change-the-open-ondemand-ssh-port/3639/1 "2024-07-22T15:01:06Z")

</div>

All my machines use SSH port 24739, but when I try to login via SSH, I get “ssh: CONNECT TO HOST \* PORT 22: connection refused.” I found a similar question on [Open OnDemand Discourse](https://discourse.openondemand.org/t/change-login-ssh-port-in-cluster-config/2419), but it has no answer. I tried setting OOD\_SSH\_PORT=“24739” in `/etc/ood/config/apps/dashboard/env`

 ![1234](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/e/e7537db28490929f83947a7d5649f5a74b316226.png)  
, but it didn’t work.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [July 23, 2024, 1:30pm UTC](https://discourse.openondemand.org/t/how-can-i-change-the-open-ondemand-ssh-port/3639/2 "2024-07-23T13:30:19Z")

</div>

That configuration is for something different unfortunately. I would say to provide an ssh wrapper that can set the port.

[https://osc.github.io/ood-documentation/latest/customizations.html?#shell-app-ssh-command-wrapper](https://osc.github.io/ood-documentation/latest/customizations.html?#shell-app-ssh-command-wrapper)

---

<div class="post-metadata">

**Author:** ![dai542](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/dai542/32/2669_2.png) [@dai542](https://discourse.openondemand.org/u/dai542)\
**Post date:** [July 23, 2024, 3:38pm UTC](https://discourse.openondemand.org/t/how-can-i-change-the-open-ondemand-ssh-port/3639/3 "2024-07-23T15:38:37Z")

</div>

```auto
[root@oodrk9dev tmp]# cat /usr/bin/ssh_wrapper.sh
#!/bin/bash

args="-o SendEnv=MY_ENV_VAR -p 24739"
echo "SSH Arguments: $args" >> /tmp/ssh_wrapper.log
exec /usr/bin/ssh "$args" "$@"

```

```auto
[root@oodrk9dev tmp]# cat /etc/ood/config/apps/shell/env 
OOD_SSHHOST_ALLOWLIST="sl-c[0-9][0-9][0-9][0-9]"
OOD_SSH_WRAPPER="/usr/bin/ssh_wrapper.sh"

```

These settings still did not work, and it continued to indicate that the connection was on port 22. Ultimately, it only took effect when I set `Host * Port 24739` in `/etc/ssh/ssh_config`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [January 19, 2025, 3:38pm UTC](https://discourse.openondemand.org/t/how-can-i-change-the-open-ondemand-ssh-port/3639/4 "2025-01-19T15:38:44Z")

</div>

Closed on January 19, 2025, 3:38pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
