Set screen brightness on Ubuntu laptop

xrandr --output `xrandr | grep connected | head -n1 | cut -f 1 -d' '` --brightness 0.5

Solarised on gnome terminal


Check Ubuntu version

lsb_release -a

Firewall off all ports bar http, ssh

To quickly set up iptables to firewall off all ports that are not http (80) or ssh, as root:

iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -P INPUT DROP
iptables -I INPUT 1 -i lo -j ACCEPT
iptables -L -v

Note that these iptables will not be persistant accross reboots unless you also use iptables-persistent

Tested on Ubuntu 12.04.4 LTS

Fix ‘shellshock’ bash vulnerability

In Ubuntu:

$ env X="() { :;} ; echo busted" /bin/sh -c "echo completed"

No problem with /bin/sh because Dash is the default shell. However when we specify bash:

$ env X="() { :;} ; echo busted" `which bash` -c "echo completed"

Uhoh, time to update:

$ sudo apt-get update && sudo apt-get zsh && sudo zsh
# apt-get install bash
# exit
$ env X="() { :;} ; echo busted" `which bash` -c "echo completed"
/bin/bash: warning: X: ignoring function definition attempt
/bin/bash: error importing function definition for `X'

Tested on Ubuntu 12.04.4 LTS

Bits and bobs

Install / Append SSH Key In A Remote Linux / UNIX Server easily