steve's SSHD Port Change

Deployment scripts have been deprecated and will be unavailable from 1 October 2026. To run setup commands when creating or reinstalling a Server, use the Enable Cloud-init User Data field on the create, reinstall, or change-plan pages instead.

See Cloud-config for Linux servers for details.

Supports: CentOS 6 (32-bit and 64-bit), 6.5 with cPanel (pre-installed) (64-bit); Debian 7.0 (32-bit and 64-bit); Ubuntu 10.10 (32-bit), 12.04 LTS/14.04 LTS (32-bit and 64-bit)

Source Code

#!/bin/bash

# <?env name="sshd_port" label="SSH Port" example="New port to be used for SSH connections" default="22" ?>

function configure_ssh_port {
sed -i "s/^Port .*/Port $SSHD_PORT/" /etc/ssh/sshd_config
test -e /etc/init.d/ssh && /etc/init.d/ssh restart
test -e /etc/init.d/sshd && /etc/init.d/sshd restart
}

configure_ssh_port
Preload Preload Preload