Flabby Rabbit | The offical home of The Rabbit

Archive for the "Linux" Category

Setting default monitor for Ubuntu

When using dual screen the gnome panels automatically get attached to the default monitor. If you have something like nvidia x-config you can easily change this using their software, but what if you don’t? Open up a new terminal window and enter: xrandr –prop | grep "[^dis]connected" | cut –delimiter=" " -f1 This will display [...]

Read More ›

How to Add Bash Completion in Debian

apt-get install bash-completion Now simply add the following to /etc/profile to enable it system wide or ~/.bash_profile for a certain user. if [ -f /etc/bash_completion ]; then  . /etc/bash_completion fi

Read More ›

Installing ZNC (IRC Bouncer)

A BNC (short for bouncer) is a piece of software that is used to relay traffic and connections in computer networks, much like a proxy. Using a BNC allows a user to hide the original source of the user’s connection, providing privacy as well as the ability to route traffic through a specific location. A [...]

Read More ›

Change Default URL of phpMyAdmin

By default phpMyAdmin is installed at example.com/phpmyadmin. Changing this URL will make your instillation that bit more secure. To change this you need to edit the apache.conf file in the phpMyAdmin’s configuration directory. This is usually in /etc/phpmyadmin/. At the top of this file there should be the line: Alias /phpmyadmin /usr/share/phpmyadmin Simply change the [...]

Read More ›

Automatic Website Screenshots

I wanted to make an archive of certain sites at a regular interval. But how to get a screenshot of a website automatically? I found this http://www.debian-administration.org/articles/413 which was almost there but not really what I was looking for. I have adapted the script to closer meet my requirements. #!/bin/bash SITE="http://www.hackthis.co.uk" FILE="hackthis-$(date +%F).jpg" vncserver :1 [...]

Read More ›

Connect to SSH with bash script

sudo nano /bin/connect #!/usr/bin/expect -f spawn ssh user@example.com match_max 100000 # Wait for password prompt expect "*password:*" send — "password\r" send — "\r" interact #expect eof Changes need to be made on these lines: spawn ssh user@example.com send — “password\r” Now allow the script to be executed by all users on your system sudo chmod [...]

Read More ›

Checking if a file has been modified using Bash and Crontab – Part 2

After reading the first part you should already know I have a fully working bash script. That will launch a screened PHP script if a file has not been edited for the previous 15 minutes. This part we will be looking at automating the script using crontab. A crontab file contains instructions to the cron [...]

Read More ›

Checking if a file has been modified using Bash and Crontab – Part 1

I needed to check if a file had been edited in the last 15 minutes. This seemed like the simplest way to check if a PHP script was still running. I started off by creating a bash script the, hopefully, would compare the current time and the last modified time stamp on the file. I [...]

Read More ›

 

Essentials