dinsdag 6 oktober 2009

Command line fu

Hi
these are a list with more complex commands i regularly use with a description of what it does

execute the last command but with sudo priveliges
sudo !!



download the entire site www.example.com as it is presented to an anonymous user using a mozilla browser

wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com





get stats on the network-speed to a host


mtr hostname





twitter from command line (very usefull to keep track of machines)
this twitters the output of the command "uptime"

curl -u mytwitterusername:mypassword -d status="my uptime:`uptime`" http://twitter.com/statuses/update.json


more info here: http://mark.koli.ch/2009/05/howto-tweet-from-the-command-line-with-curl.html

enable passwordless ssh the easy way

ssh-copy-id user@remote-machine



make shift alarm clock

sleep 8h; cat /dev/urandom > /dev/dsp

maandag 5 oktober 2009

Securing a drupal development enviroment

Sometimes After a sync with production our testing site needs to be re-secured (since it's testing we don't want people using it)



install the securesite module

http://drupal.org/project/securesite
obviously you don't need to do this every time if you also install the module on your production enviroment, but switch it off overthere.



Activate the module
on http://yourURL/admin/build/modules

Change the Settings
: http://yourURL/admin/settings/securesite (Force authenticatoin ‘Always’)

That should do it

Props to my good friend Sven

vrijdag 2 oktober 2009

ssh-fu

Ok this is basicly a post were i keep track of some much used ssh commands,
there will probably be things added to this post as time goes by.

use x2x to share keyboard and mouse between 2 computers


Both PC's have to be running X and be logged in
from a shell within X on the PC that has the keyboard and mouse do
 ssh -XC remoteuser@remoteip  x2x -east -to :0.0 




Use SSH tunnel to secure your webtraffic


on the local machine configure firefox to use localhost & port 7070 as a proxy
then log into a shell and execute
ssh -D 7070 username@remote-host




connect over SSH to a computer behind a NAT firewall using a reverse SSH tunnel


on the remote machine (the one behind the firewall) do
ssh -R 19999:localhost:22 sourceuser@138.47.99.99 


Where 19999 can be anny random unused port
138.47.99.99 is the IP of the machine from where you want to access the "remote machine"

now on your server (theone at 138.47.99.99) do

 ssh localhost -p 19999 

and you should log into the machine behind the nat