Hacker News new | ask | show | jobs
by dest 2808 days ago
Very nice. I'd consider pinging the guys of OpenBSD to suggest upstreaming this interesting, user friendly, syntax into SSH itself.
2 comments

is the ssh syntax for doing the same thing really that bad ?

I find it easy to remember, it's just one flag (-L) with local_port:remote_ip:remote_port

to forward local port 3306 to mysqlhost:3306:

    ssh -L 3306:mysqlhost:3306
The strength of using ssh is that you can forward multiple ports with the same connection. i.e.

    ssh -L 3306:mysqlhost:3306 -L 8080:webhost:80
If it's easy for you to remember ssh syntax, then for you ssh is the better tool. As far as I'm concerned, I never remember the different syntax between -L, -R, -D, etc. Always have to read a doc somewhere.

In the same topic, do you remember the syntax of tar? I don't. https://www.xkcd.com/1168/

I use tar daily, so yes, i remember the syntax :)

copy files from a to b:

    (cd /src && tar cf - .) | (cd /dest && tar xf -)

operations are easy :(c)reate, e(x)tract, (t)est options the same: (f)ile, (v)erbose, g(z)ip compression. the only illogical ones is bzip2 compression and xz compression with -j and -J

I think i can remember cpio syntax as well, though i haven't used that i a decade, but did use it quite often in my old sysadm job.

copy files from a to b by piping :

    find /somewhere -print | cpio -o | (cd /destination && cpio -i)
or simply for all you kids:

    find /somewhere -print | cpio -p /destination
Well, it turns out we have different expectations regarding those tools.

My brain chooses to store other things in life.

This seems to imply that he is not 'storing other things in life' because he's able to remember that L=local forwarding R=remote forwarding and D=socks proxy
The irony being that remembering that is almost guaranteedly easier than acquiring and installing mole on every machine where you may need to Port forward.
It was fun when I mixed up source and destination in my tar command and overwrote 4 hours of work ;)
You can do the same thing with the ~/.ssh/config file. Add a configuration block for the host you want to connect to with the ports you want to map. I agree that an official user interface to editing the config with the most common examples would be really handy.