Posts Tagged ‘ssh’

Get your default gateway from the terminal

Wednesday, June 22nd, 2016 | Tech

If you are inside a Vagrant box and want to SSH to the host machine, you will need to get the default gateway. Or, maybe you just need the default gateway for a completely different reason. Either way, the following command should do it.

netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10

This is really useful if you don’t have ifconfig installed.

SSH tunnel command just logs you in

Friday, April 26th, 2013 | Tech

If you’re trying to create an SSH tunnel, you may find that running the command just logs you into the remote server.

ssh -L 27017:somehost:27017 user@examplehost.net

To solve this, you need to use the -N flag.

ssh -L 27017:somehost:27017 -N user@examplehost.net

This will then just set up the forwarding, and not run the command.

Error resolving hostname on SSH tunnels

Saturday, April 20th, 2013 | Tech

Lets say you are trying to create an SSH tunnel.

ssh -L 27017:somehost:27017 you@examplehost.net

You may get the following error message.

ssh: Error resolving hostname \342\200\223L: nodename nor servname provided, or not known

This is caused by using the wrong kind of minus symbol. If you have copied and pasted the command from somewhere, this is probably the case. This is easy to fix – simply paste the command into your terminal, then go through it, remove the existing minus symbol and put a new – in.

Speed up really slow SSH connections

Monday, April 8th, 2013 | Tech

Sometimes, you might find that when you try and SSH into another server, it seems to hang, but then after around 30 seconds or so, will suddenly start working again. You can diagnose where it is stopping by using verbose mode.

ssh -vv user@example-server

If you find it is to do with GSS API, you can disable this in your SSH configuration.

cd ~/.ssh/
vim config

Add the following to it.

GSSAPIAuthentication no

This should then speed the login up.

Changing your SSH port

Thursday, May 3rd, 2012 | Life, Tech

If you want to change your SSH port to something a little less obvious, it’s easy to do. It’s debatable how much security it actually gives you, but it will certainly make you feel safer, and that is probably the most important thing.

pico /etc/ssh/sshd_config

I’m using pico in this example, but vim will work just as well. You should find a line which is commented out, specifying that the port is 22. This doesn’t need to be uncommented normally, as it defaults to port 22.

#Port 22

Just uncomment this and put a new port number in.

Port 8473

Now save the file and exit. Finally, restart SSH for it to take affect.

/etc/rc.d/init.d/sshd restart

Don’t forget, next time you SSH in you will need to use the new port number!

ssh -p 8473 hostname

Initial thoughts on the iPhone

Sunday, August 30th, 2009 | Reviews, Tech, Thoughts

Got myself an iPhone this week as, as much as I love my Sony Ericsson k800i which has served my exceptionally well for these part three years (it is honestly a fantastic phone) it is started to look a bit dated and as what most people would consider to be a geek, I decided I needed to move with the times a bit more.

So far I have thought it a very nice device to use, it’s not the greatest invention to ever benefit man kind but as a smart phone it does what it needs to do exceptionally well. I don’t use a great deal of applications but I am loving having Tweetie and Facebook at my finger tips and easy access to Wikipedia and the web has proved very useful as well – not that these are something specific to the iPhone of course.

It really came into it’s own at the pub today though when Norm informed me that my podcast feed was down. This was a most amateur mistake on my part of having the permissions set wrong on the config file and so when I did an upload the local copy which specifies the full domain name as the database host overwrote the live permission and MySQL kicked the remote connection from my server’s ISP into touch.

I needed to fix this fast so I headed over to the Apps Store and found myself a (free) SSH client which installed in a few seconds and allowed my to connect in to my server via SSH from my iPhone, go into the file I needed to update using vim and edit to the host to the correct setting. Problem solved!

The real test of course is when my number ports over on Tuesday and I start actually using it as a phone.

I also have yet to work out how I am going to set everything up – at the moment I have it syncing with iTunes at work because I don’t want to spoil my home machines with such software. However I need to sync it with my music so I can make use of the music functionality. And work out if I can connect it to the hands free kit in my stereo – otherwise I may end up making in car calls on my k800i still!

iPhone