Reverse tunnel technology enables remote access to UniFi controllers that operate behind network address translation (NAT) or firewalls. Instead of requiring port 22 to be publicly accessible, SSH reverse tunneling creates an outbound connection from your local port to a remote SSH server, establishing remote port forwarding for secure communication.
But once you're done with our service, you may want to undo changes, so as to remove previously granted access to Spotipo. Which is understandable.
Luckily removing the tunnel is quick and easy, and shouldn't pose any issues if you've easily installed it in the first place.
Removing the tunnel and the adjacent services
First you need to uninstall the service file. This can be done by entering the following commands:
sudo systemctl stop spotipo-tunnel.service
(Stops the service, so that you can safely remove it)
sudo rm -f /etc/systemd/system/spotipo-tunnel.service
(Removes the service file)
Please note that it is necessary to have to have privileged or root access to the machine that you're removing tunnel from. Otherwise you won't be able to remove the service file.
Removing autoSSH
Auto SSH is the service used to control this entire tunnel, but it is not removed by simply removing the spotipo-tunnel.service.
It is possible that this service is already removed from your UniFi, as it is sometimes purged from UniFi on reboots or updates. But just in case, run the command:
(Before you run this command, make sure that you're not using autossh for anything else on your UniFi machine)
sudo apt purge autossh
This should remove any traces of autossh if it is still on your UniFi machine.
Double check everything
If you've done everything right, there shouldn't be any tunnel service if you navigate to the system folder
ls /etc/systemd/system
Also, in your Spotipo account, controller status should now be either "Offline" or "Invalid Credentials".
If you need to set things up again, simply follow our setup guide again to gain Insight into everything once more.
