Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Change the default SSH server port on 10.3' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change the default SSH server port on 10.3
Authored by: foobar104 on Jun 10, '04 12:32:57PM

Better idea: turn off sshd via xinetd, and create a StartupItem for it.

Just change "disable = no" to "disable = yes" in /etc/xinetd.d/ssh. Then create a directory called /Library/StartupItems/SSH. In that directory, create a script called SSH (no file extension) that looks like this:

#!/bin/sh

. /etc/rc.common

StartService ()
{
ConsoleMessage "Starting SSH"
if [ -x /usr/bin/sshd ] ; then
/usr/bin/sshd -p 8855
fi
}

StopService ()
{
if pid=$(GetPID sshd); then
ConsoleMessage "Stopping SSH"
kill -TERM "${pid}"
else
echo "sshd is not running."
fi
}

RestartService ()
{
if pid=$(GetPID sshd); then
ConsoleMessage "Stopping SSH"
kill -HUP "${pid}"
else
echo "sshd is not running."
fi
}

RunService "$1"

Make sure /Library/StartupItems/SSH/SSH is executable. Then, finally, create a StartupParameters.plist file in /Library/StartupItems/SSH.

{
Description = "SSH";
Provides = ("SSH");
OrderPreference = "Late";
}

There you go. That way you can start and stop SSH without having to change the global /etc/services file, which you shouldn't mess with. To start it, do "sudo SystemStarter start SSH".



[ Reply to This | # ]
Change the default SSH server port on 10.3
Authored by: webbix on Jun 10, '04 12:47:27PM

I am not changing my port so I have not tinkered but you may also install Webmin which gives you a webinterface to configure SSH as wel as other builtin servers/services (including your postfix and in the latest version, the firewall)



[ Reply to This | # ]