So I finally got around to learning some Linux basics I should have learned over a decade ago.

in linux •  6 years ago 

I've been using Linux for quite a long time, chances are longer than at least one person reading this has been alive. I started out with Redhat 5.0 in 1998 - I'm in the Debian derived world with most non-corporate Linux users these days, but I've been at it for a while.

When I first started using Linux I had a nice new ISA plug and Play US Robotic modem. I went to the store and bought a nearly identical ISA plug and Play modem with one difference - I bought the model that had jumpers on it so I could actually hard-configure the serial port instead of having to play fight with immature Linux plug and play implementations at the time just so I could get online. That's a little perspective on how old and decrepid I am (okay, not THAT old).

I have to admit - in many respects I've been a lazy Linux user. I've learned the command line, I've been writing Bash scripts for years (just as I wrote .bat files for DOS and scripts/menus for Novell before that) but outright basics were neglected.

It amazes me for how much I learn there's always super-obvious basic things Linux is capable of doing I just haven't taken the time to learn. My free-time has become more valuable the more I age and the more kids I have, so yeah, I've known what SSH and X-forwarding could do for years, but I never bothered learning how to do it until the past couple of days. I have to tell you - it was totally worth learning. Oddly enough I learned it for MS Windows purposes....

I've had VNC working with SSH for a long time - tools built into my distros made that so automatic and easy I didn't really have to think about it, and SSVNC made connecting easy even when the KDE built in remote system viewer or Remmina just didn't want to do the job. (Sadly the KDE one isn't very good overall - too bad, I prefer to use KDE stuff in general but have resigned myself to the GTK Remmina which is beautiful in it's functionality)

I've got OpenSSH_for_Windows installed on my work laptop - any time I have a Windows system for work, that I'm allowed to admin, I find it important to put an SSH client on it. Generally, my lazy approach to things I've mostly used it as a replacement for telnet and rlogin. If I would have known how easy port forwarding was I think I would have done it years ago. Not only did the command:

ssh -L 5900:127.0.0.1:5900 [email protected]

make it so that I it forwarded my Windows systems attempts VNC client to "attach to itself" over to the destination system, it allowed me to launch x11vnc from the command line window it opened. Granted, a lot of people would just leave x11vnc running, but I've chosen not to since this is a server and I want the minimum running on it at all times. (the type of server that I'm connecting to still needs a GUI for configuration reasons)

For those of you who've played with actual IPFS daemons and use the browser plugins you should see the benefit of something like this right away - a single IPFS daemon running in the household - much like an old fashioned proxy-cache, but used by all your systems.

Then I thought about it. I've known about X-Forwarding forever. I've never used it. One of those things I thought was complicated, and it turns out it really wasn't. I looked up a how-to - apparently I just need to use a -X or a -Y when I ssh one *NIX like system to another (not sure how Macs fair with this just yet, I may test when I get home but I know Macs have an X-server available - old version of Gimp for Mac required it and it was a pain to use - two clicks, one to switch to X, then one to select the window) Maybe, just maybe I can X-Forward the individual program I need to work on the server and not have to do an entire VNC session. I tested from my Linux VM to the server. Worked great! I was a little confused at first, I SSHed in with a -X and I thought I was going to get a GUI, instead I got a command prompt. Then I typed the classic X test program - xeyes. Yep, it worked. (further experimentation shows me I can put the command I want to run at the end of my ssh command and it will launch)

Now for Windows. Windows doesn't have a built in X-server (though the post Gates/Balmer Microsoft really is working to integrate compatibility these days). It did some playing around, then I found one that actually worked VcXsrv (open source programs have such easy to remember names sometimes).

X-Forwarding.png

There it is! Xeyes working on Windows.

Now - you ask yourself - why would I want to do something like this? What program could I benefit from running on a system over there while I'm sitting over here?

One good answer for you: Any program that is licensed per computer or requires an identity file like Akasha.

So I thought about it and I started doing the ground work - how would I make a single icon to launch Akasha running on my Linux system on my work Windows laptop. I'll make it easy for you, I went to my VcXsrv directory under program files and I found this command works:

plink -ssh my.remote.system -l user -X -pw MyPassword xeyes

Sure you're storing a password in plain text on your local system, but using that line right there (you can make a windows shortcut icon with that embedded) will launch xeyes without any further prompting. Keep your drive encrypted and obviously don't do this on a computer that isn't yours.

So - what other obvious/simple things are out there the rest of you have been putting off for years? This was easy learning for me, I regret not having picked it up years ago. The last thing I picked up and started doing that I regretted not learning earlier was making bicycle wheels. It's a lot cheaper when you know how to replace/fix your own spokes, and making whole wheels allowed me to change the gearing outright.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!