New on LowEndTalk? Please Register and read our Community Rules.
Port Forwarding Tricks
Don't run development tools on your VPS - just don't do it.
I would never run something like phpMyAdmin on a VPS unless I was hosting for other users that had no idea what they were doing.
Did you know you can run phpMyAdmin (or MySQL Workbench) on your own computer and use an SSH tunnel to have it access the MySQL on your VPS?
ssh -L 33066:127.0.0.1:3306 [email protected]
This will allow you to configure your phpMyAdmin to listen over port 33066
and have it forwarded to your VPS. You can even add it as an alias in your .bashrc ($ vim .bashrc
) so you can call it like $ vps_db
?
alias vps_db = 'ssh -L 33066:127.0.0.1:3306 [email protected]'
This also works for browsing the web if you want to have your own private HTTP(s) proxy so your IP shows your VPS IP.
So what port forwarding techniques do you use most often?
Comments
Excellent tip!
Or one can use Adminer instead, which is a lightweight, single file (200 kb) alternative to phpmyadmin. The only place I use phpmyadmin is on my local XAMPP installation. Either way it's good to know one can do that when needed. Thanks!
Well, you still don't want a public facing MySQL administration utility on your VPS - even if it is SQLBuddy, Adminer, or phpMiniAdmin.
Personally, I say they should all banned so people will learn a real administration system like MySQL Workbench.
So should all GUIs unless you have a minimum 5 years command line exp.
Oh that will go over well with my soccer moms.
@Aurora, it's about choosing the right tools for the job - not competing for the fun of it. Sure, I wish more people used the prompt - but you can only do so much there. Charting complex database relations using graphs isn't possible via
$ mysql
but is thanks to the MySQL Workbench.I was just saying that the GUI has ruined a lot of things. If people HAD to use a command line and learn it not only would it make it better for them in the long run but also it might be better on the providers. A lot of problems can be solved if the user would only take the time and think through it.
Here is an easy and stupid example. I walked into a place a couple years ago. This place was supposed to help others get jobs. I noticed a whole line of computers not working. So I asked what was wrong with those. The lady running it said the monitors would not turn on. She went on to explain that the "techs" (I have to use this term very loosely) could not even figure them out. I walked over and took a look behind them to see if they were plugged in. Turns out they had plugged them into the computer but not the wall outlet. Two minutes of thought could have solved this problem and anyone could have done it.
I realize this has nothing to do with the command line but if more people knew how to use them then maybe they could do their own tests which could then help the techs help them. I understand the need for GUI for some people and I use them myself but at least if things go wrong I know enough to use other methods to get the job done.
No it probably would not go over now but if they had to learn it to begin with they would not know a difference.
I know this entire post is way off topic so I won't go down it here. PM me if you would like to continue this discussion. It is not fair for any of us to hijack a thread. I am sorry I did this and apologize.
id like to see udp port forwarding trick... ;/
Nice! What is suggested seems like a good foundation for controlling, not for only Mysql
As you said that's better security wise, and probably for speed and lessen the load on VPS end, overall it's better imo.
But at the same time I thought having everything on the VPS might be useful at one day, like if something went wrong while you are abroad and have public PC to connect from, and also it's not running Linux! does for example phpMyAdmin, have a Windows version? So that in a public PC one can setup (quickly!) SSH tunnel and anything like phpMyAdmin
Sure you can put XAMPP+PMA and Putty on an USB drive and then walk around with everything you need to administrate the server. Keep in mind that in some public places certain ports etc might be blocked tho.
Or just put a Linux distro on the USB drive and boot the machine from that. Assuming, of course, that you won't get kicked out of whatever place for doing so.
@AuroraZ
I have a couple who have learned command line but 99.9%, I wouldn't even suggest it.
Of course though that's what I cater to.
@Go59954
Could always put Apache on a USB stick and localhost it. I would think that would work.
(edit: I missed that suggestion made up there. Sorry.)
@gsrdgrdghd
sigh Story of my life.
Actually, I can do better than that. Install my WNMP server which allows you to use whatever version of NGINX, PHP, MySQL, Memcached you need to match the exact version your server is using.
I am grateful for your contribution, you spoke in a well written and thoughtful way. Comments like this are never unwanted even if they are off topic.
phpMyAdmin runs on PHP, the OS doesn't matter as long as PHP works.
Yeah, is my dream too
udp port forwarding
Damn, seems complex to read now :P, bookmarking n_n
Thanks
GUI is also capable of introducing more advanced concepts to novice users. phpMyAdmin, for example, gives you a raw dump of damn near everything you do. Don't know how to select/edit multiple fields? Do it in phpMyAdmin, review the raw output. Command learned.
I use http://www.sequelpro.com/ for MySQL administration which has built in SSH tunneling.
I know that's the common pronunciation for SQL, but it still irks me every time I hear it. <_<
It pisses me off when people don't just say S-Q-L, so when I'm around those kinds, I use "squeal" specifically. Like "my squeal"
Rather than a shell alias, usually I just add the entry to SSH config file. For example
One advantage is that the configuration is also used by other applications that use SSH (rsync, git, etc).
WoW nice tut. thank you
I use
ssh -D 4000 remote-user@remote-host
4000 is local port. After doing this there is a socks5 proxy on my local 4000 port.
Now in any application if you set your socks proxy to be 127.0.0.1:4000, all the remote sites will see your remote-host IP.
Note - In firefox, leave all but socks proxy options empty. Else it will not work.
Note 2 - On linux system use tsocks to force applications like apt-get to use proxy. The command then looks like
sudo tsocks apt-get install wmd
Cheers!
Too much trouble if you need to forward multiple ports. I just use OpenVPN and then I can access all ports. Be sure to setup iptables (I use ufw frontend) of course.
For the more than mildly paranoid the ssh with port forwarding can be a bit better than the VPN option. The reason is access. The ssh solution is a one way tunnel. The far side has no access. This is not the case with the VPN. Well unless you take the effort of setting up a very restrictive firewall on the VPN.
When working remotely with my "day job" I used to do ssh tunneling only. They removed that and now my only option is the wonderful Microsoft PPTP VPN. I don't like that so much. Tons of crap comes in over that interface from the work network.
You can't ssh tunnel?
I have a database that's over 210 tables, 2760 columns. Now I have had to document each and every single one of these and how it functions, what the values represent and how they affect the web app along with huge algorithms. Tell me, of what benefit am I going to get putting a command line up on a big screen in front of 3 developers? I'm damn curious.
For those of us that actually do need to make a living and be somewhat time efficient there's great apps out there such as Navicat. For the rest that want to relive their hey-day as a neanderthal I guess there's the command line for that!
Related - http://i52.tinypic.com/10i5apg.png (yes, that's 2826 tables)
Sadly, there's quite a bit I'm forced to do through raw SQL (such as the query above). Despite my affinity for CLI, and having primarily used console for close to 20 years, I do greatly appreciate the times I can use an application's interface to get a lot of work done in a timely manner.
@Aldryic is that a JDE table? I have that program on my machine, but I never use it for anything.
WTH why did this suddenly become such a personal thing. I am sorry I did not say in my opinion the GUI has ruined a lot of things. It has for some of us. If I am neanderthal then I guess I am a neanderthal. Joel if you want an argument look elsewhere I have neither the time nor the motivation to argue with you or anyone else here.
I happen to like using it and happen to know from experience that most people coming to Linux/Unix platform need CLI experience. If you don't have the experience when your GUI falters where is your information? Do you load another GUI? Do you run to the developer and scream at him? When he tells you how to fix it or it does get fixed how is the fix applied usually? The CLI is an important tool and people need to learn about it. That is the last thing I shall say in this thread as it has now been derailed big time.