If you are getting an error message similar to
/usr/bin/xauth: timeout in locking authority file /home/username/.Xauthority
you are probably facing one of the following scenarios.
Continue reading xauth and .XauthorityIf you are getting an error message similar to
/usr/bin/xauth: timeout in locking authority file /home/username/.Xauthority
you are probably facing one of the following scenarios.
Continue reading xauth and .XauthorityI like to display keyboard entries, code examples and sample outputs with distinctive formatting using the <pre>, <kbd>, <code>, and <samp> tags. I also like this formatting to appear uniform across the whole web site
Continue reading Don’t like your WordPress theme? Modify it.I really hate it when an application automatically rewrites the code I provide without asking me first.
Continue reading WordPress html code rewriting and the frustration it causesThe 16 commands you need for a fully functional WordPress installation.
Continue reading WordPress installation – 16 commands from start to finishOn occasion you may find that the stock kernel just does not cut the mustard and decide to change some of the configuration parameters and re-compile. Below is a list of the steps involved.
Continue reading CentOS 6.4 kernel compileMy old Ubuntu 12.04 server had serious performance problems with NFS exported home directories and the decision has been taken to use CentOS as the next server distro.
Continue reading CentOS 6.4 installationIf you have ever tried correcting the MP3 tags for many tracks in your music library, you probably have grown tired of the manual process very quickly, just like me.
Continue reading MusicBrainzPurpose: start/maintain/stop a reverse ssh tunnel to an always-on ssh accessible server
Naming conventions:
middleman is the ssh server that will be used to access the client machine
middleman has IP address mm.ip.addr
cuid and mmuid are users with access rights to ssh on client and middleman respectively
On client have nmap, autossh, openssh installed
On server have openssh-server installed and runnig
On client log in as cuid:
ssh-keygen # press enter twice for empty password
cat .ssh/id_rsa.pub | ssh -l mmuid mm.ip.addr sh -c "cat – >> ~/.ssh/authorized_keys"
nano /etc/network/if-up.d/start_autossh_rev_tunnel
#!/bin/bash
#
#echo Checking for autossh…
[ -x /usr/bin/autossh ] || exit 0
#echo Checking for ssh…
[ -x /usr/bin/ssh ] || exit 0
#echo Checking for nc…
[ -x /bin/nc ] || exit 0
#echo Checking for server…
[ ! `/bin/nc -z -w 1 163.1.6.117 22` ] || exit 0
#echo Stopping any already running autossh instances.
killall -q -TERM autossh
sleep 1
#echo Starting reverse ssh tunnel.
su -l -c "/usr/bin/autossh -4 -M29002 -f -N -R 1411:localhost:22 zjl@163.1.6.117 -oLogLevel=error -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no" zjl || exit 0
#echo All done.
exit 0
nano /etc/network/if-up.d/stop_autossh_rev_tunnel
#!/bin/bash
#
#echo Stopping any running autossh instances.
killall -q -TERM autossh
#echo All done.
exit 0
chmod +x /etc/network/if-up.d/stop_autossh_rev_tunnel /etc/network/if-up.d/start_autossh_rev_tunnel
Links:
setting up ssh keys
http://paulkeck.com/ssh/
reverse ssh tunnel
http://www.howtoforge.com/reverse-ssh-tunneling
http://jiang925.com/content/tunnel-through-firewall-using-reverse-ssh-and-vpn-dd-wrt
autossh script to start reverse tunnel
http://forums.gentoo.org/viewtopic-t-875883.html
http://www.vdomck.org/2009/11/ssh-all-time.html
Ubuntu man page(s)
http://manpages.ubuntu.com/manpages/lucid/man5/interfaces.5.html