Aug 30 2012

php command line bandwidth monitor

Tag: phperm @ 10:55 am

I wrote this quick & dirty bandwidth monitor for use with htop. It also displays the average bandwidth for the last 10 seconds.

It displays a line similar to this at the top of the screen:
eth0:RX:600b TX:944b Avg:77b eth2:RX:0b TX:0b Avg:0b

Usage is simple:
$ ./bw.monitor.php & htop
Continue reading “php command line bandwidth monitor”

Aug 28 2012

How to setup an sftp/ssh server with denyhosts on ubuntu

Tag: Linux,tutorialerm @ 2:50 am

Throughout this document I will have <keywords> encapsulated in brackets. Substitute what the keyword is for the appropriate value. For instance <username>@localhost would become erm@localhost, or whatever your username is.

Cliffnotes version commands:

Install open ssh:
$ sudo apt-get install openssh-server

Backup ssh config:
$ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.`date +%Y-%m-%d`.bak

Edit /etc/ssh/sshd_config:
$ sudo nano /etc/ssh/sshd_config

Enable sftp:
Subsystem sftp /usr/lib/openssh/sftp-server

Restart ssh:
$ sudo /etc/init.d/ssh restart
$ sudo service ssh restart

Test your server:
$ ssh <username>@localhost

Test your connection:
$ echo $SSH_CLIENT

Log out of ssh:
$ <ctrl+d>
$ exit

Install denyhosts:
$ sudo apt-get install denyhosts

Backup denyhosts config:
$ sudo cp /etc/denyhosts.conf /etc/denyhosts.conf.`date +%Y-%m-%d`.bak

Edit denyhosts config:
$ sudo nano /etc/denyhosts.conf

Edit lines:

Restart denyhosts:
$ sudo /etc/init.d/denyhosts restart
$ sudo service denyhosts restart

Get your remote ip:
Visit: or

Get your lan/local ip:
$ ifconfig

Login via remote computer from inside lan:
$ ssh <username>@<localip>

Login via remote computer from outside lan:
$ ssh <username>@<remoteip>

Continue reading “How to setup an sftp/ssh server with denyhosts on ubuntu”