Reference:
- https://wiki.archlinux.org/index.php/Systemd/User#Automatic_start-up_of_systemd_user_instances
- https://superuser.com/questions/1025091/start-a-systemd-user-service-at-boot
- https://unix.stackexchange.com/questions/521538/system-service-running-as-user-is-terminated-on-logout
$ sudo loginctl enable-linger $USER
Don't use WantedBy=multi-user.target
.
-
Create a unit file
~/.config/systemd/user/dynamic-1086-proxy.service
[Unit] Description=Establishes a sock5 proxy on port 1086 (ssh -D 1086) [Service] ExecStart=/usr/bin/ssh -CND 1086 YOUR-PROXY-SERVER-HOST Restart=always RestartSec=5 [Install] WantedBy=default.target
Notice: replace YOUR-PROXY-SERVER-HOST with your own proxy/jump server.
-
enable and start service
systemctl --user enable --now dynamic-1086-proxy.service # to check service status systemctl --user status dynamic-1086-proxy
-
Then, if you have SwitchyOmega installed in Chrome or Firefox, you can add a proxy Profile and fill like below:
SOCKS5 127.0.0.1 1086