You can add commands to
/etc/rc.local
sudo vim /etc/rc.local
This executes the commands as root.
To execute commands as a specific user, use sudo -i -u
(-i to also run the login shell). For example, to establish a persistent SSH tunnel, where myhost is definde in johndoes ~/.ssh/config file:
sudo -i -u johndoe autossh -nNT -L 1234:localhost:1234 myhost
jupyter notebook --ip=108.168.1.231
Note that if /etc/rc.local/ was empty, it might not have existed, so you need to add a shebang line at the top (e.g. #!/bin/bash), and ensure the file is executable:
sudo chmod +x /etc/rc.local