1

I would like to configure sshd.

My ssh.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>Label</key>
<string>com.openssh.sshd</string>
<key>Program</key>
<string>/usr/libexec/sshd-keygen-wrapper</string>
<key>ProgramArguments</key>
<array>
    <string>/usr/sbin/ssd</string>
    <string>-i</string>
    <string>-p 2222</string>
    <string>-f /etc/sshd_config</string>
</array>
<key>Sockets</key>
<dict>
    <key>Listeners</key>
    <dict>
        <key>SockServiceName</key>
        <string>ssh</string>
        <key>Bonjour</key>
        <array>
            <string>ssh</string>
            <string>sftp-ssh</string>
        </array>
    </dict>
</dict>
<key>inetdCompatibility</key>
<dict>
    <key>Wait</key>
    <false/>
</dict>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>

And the problem is with program arguments. When I reload configuration by running:

sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

ssh is still listening on port 22.

What Am I doing wrong?

0

I have not tried this but I can see two possible issues

  1. the arguments with spaces should be two arguments e.g. <string>-p 2222</string> should be <string>-p</string><string>2222</string>

  2. From a the launchd.plist man page

This key maps to the second argument of execvp(3). ... Please note: many people are confused by this key. Please read execvp(3) very carefully!

the execvp(3) man page says that there arguments are filename, arg0, arg1,... and that arg0 is the name of the file so your first argument should be /usr/libexec/sshd-keygen-wrapper repeating Program.

A simpler way might be to remove Program altogether and only have ProgramArguments or just use Program and give the command as if typed into command line.

Another way of making this easy is use a GUI program like Lingon or LaunchControl

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .