So You Want to be a Leader?

How do you know what a leader looks like if you've never been a follower? Here are some tip to help prepare you for leadership or to be a great team player.

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Autossh Port Forwarding

How to setup ssh port forwarding with autossh and systemd or launchtl

With more and more workloads moving to the Could I find myself in need of connecting to databases or other services that are not exposed on the internet and there is no VPN setup. To do this I tunnel my connection via SSH. When this happens, I have to remember the ssh tunneling syntax.

Typically I’ll run the following:

I use the -N (Do not execute a remote command. This is useful for just forwarding ports) and -T (Disable pseudo-terminal allocation) options so that I don’t get a tty connection on the <bastion/jump server>. When I am done, I have to kill the connection, or worse if sleep your computer you have to find the processes and kill the connection. To get around this I switched to using autossh for my ssh tunnels. This will re- establish my connection if it fails, also I can use systemd or launchctl to manage it. I find using systemd helpful for times when you have an instance you want to push data somewhere (monitoring data) and you don’t want to open up ports or setup a VPN.

For Mac users you can install autossh with brew

For Linux you can use yum or apt-get to install it.

Once it is installed, you can test a connection with the following:

For linux based systems, if you want to setup your portforward on boot, you can use systemd to do this. It also makes it easier to enable for disable your autossh setup. I have used this for remote telegraf monitoring nodes to push metrics to a Cloud based influxdb server.

File: /etc/systemd/system/autossh-tunnel.service

File: ~/Library/LaunchAgents/com.example.proxy.plist

With either the systemd or launchctl setup you can now start or stop your session. For the Launchctl I have been able to add multiple connections to a plist file, you just need to change the ports. I used the launchctl along with SwitchOmega on a regular basis. I found myself, in another country and trying to access my airline website to confirm check in, but denied access due to the country I was in. A quick update to SwitchyOmega and I was able to proxy airline website via the SSH proxy.

Add a comment

Related posts:

Something is Rank in the State of Data

This article summarizes a paper authored by Pranathi Mylavarapu, Adil Yalcin, Xan Gregg, Niklas Elmqvist. This paper will be presented at CHI 2019, a conference of Human-Computer Interaction, on…

Take a Walk

Since the weather has started to warm up and summer is around the corner, I’ve been brainstorming ideas that could help me and many others be more active. I think the winter months can be depressing…

Dark Or Light Side?

What side do you spend much of your time?. “Dark Or Light Side?” is published by Rebecca Jane Warrington in a Few Words.