Any one has working autossh on 21.02

So i just upgraded the firmware from 19.07 to 21.02, on Raspberry pi 1B
I had to reinstall all of my software and configure again.

Currently only autossh service that's not working.
on 19.07 it works without issue

any one on 21.02 has a working autossh?

this manual command works

autossh -M 20000 -i /etc/dropbear/key -N -T -f -R 12000:local_ip:22 user@vps_ip -p 22

However the service script bellow does not.

/etc/init.d/autossh

  GNU nano 5.8                                                                          /etc/init.d/autossh                                                                                     
#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2011 OpenWrt.org

USE_PROCD=1
START=80

start_instance() {
        local section="$1"

        config_get ssh "$section" 'ssh'
        config_get gatetime "$section" 'gatetime'
        config_get monitorport "$section" 'monitorport'
        config_get poll "$section" 'poll'
        config_get_bool enabled "$section" 'enabled' '1'

        [ "$enabled" = 1 ] || exit 0

       export HOME=/root <--not working with or without, as per wiki
       procd_open_instance
       procd_set_param command /usr/sbin/autossh -M ${monitorport:-20000} ${ssh}
       procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
       procd_set_param env AUTOSSH_GATETIME="${gatetime:-30}"
       procd_set_param env AUTOSSH_POLL="${poll:-600}"
       procd_close_instance
}

start_service() {
        config_load 'autossh'
        config_foreach start_instance 'autossh'
}

/etc/init.d/autossh

config autossh
        option ssh      '-i /etc/dropbear/key -N -T -f -R 12000:local_ip:22 user@vps_ip -p 22' <-- not working with or without -f option
        option gatetime '30'
        option monitorport '20000'
        option poll     '600'
        option enabled  '1'

Syslog

Sat Oct  2 15:44:31 2021 user.info autossh[4708]: starting ssh (count 1)
Sat Oct  2 15:44:31 2021 user.info autossh[4708]: ssh child pid is 4709
Sat Oct  2 15:44:32 2021 user.info autossh[4708]: ssh exited with error status 1; restarting ssh
Sat Oct  2 15:44:32 2021 user.info autossh[4708]: starting ssh (count 2)
Sat Oct  2 15:44:32 2021 user.info autossh[4708]: ssh child pid is 4732
Sat Oct  2 15:44:34 2021 user.info autossh[4708]: ssh exited with error status 1; restarting ssh
Sat Oct  2 15:44:34 2021 user.info autossh[4708]: starting ssh (count 3)
Sat Oct  2 15:44:34 2021 user.info autossh[4708]: ssh child pid is 4734

I think its the /etc/init.d/autossh file problem.
does anyone any one have a working file?

I added this line:

    procd_set_param env HOME="/root"

instead of

    export HOME=/root

and it worked.

1 Like

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