Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dweber

macrumors newbie
Original poster
Nov 7, 2022
11
1
I want OSX to always have sshd running. This means start it on boot and keep it going.

Turning on "Remote Login" is not enough, because it does not run at start-up, and it decides to turn itself off at random times.

There are a bunch of conflicting articles on StackOverflow, most of them out-of-date, most of them talking about keeping *ssh* alive, not *sshd*

I came up with this solution to put the following in /Library/LaunchAgents

Code:
<?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>Label</key>
        <string>com.blahblah.onetime</string>
    <key>OnDemand</key>
    <false/>
    <key>LaunchOnlyOnce</key>
    <true/>
        <key>ProgramArguments</key>
        <array>
          <string>/bin/launchctl</string>
      <string>load</string>
      <string>-w</string>
      <string>/System/Library/LaunchDaemons/ssh.plist</string>
        </array>
        <key>StandardErrorPath</key>
      <string>/tmp/onetime-stderr.txt</string>
        <key>StandardOutPath</key>
      <string>/tmp/onetime-stdout.txt</string>
</dict>
</plist>

It seemed to work, but sshd will still shut down. And now sshd is completely broke. When I try to log in, even from localhost, I am instantly disconnected.

I'm not sure where the best logs are, but I found this in console:

Code:
default 08:08:01.161592-0500    kernel  arm64e_plugin_host: running binary "sshd" in keys-off mode due to entitlement: com.apple.private.security.clear-library-validation

error   08:08:01.177545-0500    sshd    send failed: Invalid argument

error   08:08:01.177596-0500    sshd    send failed: Invalid argument

error   08:08:01.177622-0500    sshd    send failed: Invalid argument

default 08:08:01.182621-0500    ssh     nw_socket_handle_socket_event [C1.1.1:1] Socket received CONNRESET event

default 08:08:01.182641-0500    ssh     nw_socket_handle_socket_event [C1.1.1:1] Socket received DISCONNECTED event

error   08:08:01.182678-0500    ssh     nw_socket_handle_socket_event <private> Socket SO_ERROR [54: Connection reset by peer]


Any way to proceed? Even manually toggling sshd off and on does not fix this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.