Wednesday, October 24, 2007

Install SWAT on Ubuntu

sudo apt-get install swat

apt-get install xinetd

then, sudo vi /etc/inetd.conf

and uncomment the line:

## swat stream tcp nowait.400 root /usr/sbin/tcpd \ /usr/sbin/swat

Then make an entry for Swat under xinetd with sudo vi /etc/xinetd.d/swat

And it should look like this:
# description: SAMBA SWAT
service swat
{
disable = no
socket_type = stream
protocol = tcp
#should use a more limited user here
user = root
wait = no
server = /usr/sbin/swat
}

Then:
sudo dpkg-reconfigure xinetd

to restart with the new configuration.

Now the netstat -lt should echo something similar to this:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:5666 *:* LISTEN
tcp 0 0 localhost:1026 *:* LISTEN
tcp 0 0 localhost:1027 *:* LISTEN
tcp 0 0 *:swat *:* LISTEN
tcp 0 0 localhost:mysql *:* LISTEN
tcp 0 0 *:netbios-ssn *:* LISTEN
tcp 0 0 *:10000 *:* LISTEN
tcp 0 0 *:1040 *:* LISTEN
tcp 0 0 *:munin *:* LISTEN
tcp 0 0 localhost:ipp *:* LISTEN
tcp 0 0 *:smtp *:* LISTEN
tcp 0 0 *:microsoft-ds *:* LISTEN
tcp6 0 0 *:2080 *:* LISTEN
tcp6 0 0 *:www *:* LISTEN
tcp6 0 0 *:ssh *:* LISTEN
Which indicates the swat service is running and listening to the correct 901 tcp port.

You might be able to access http://:901/

Monday, October 15, 2007

RIBS (Rsync Incremental Backup Script)

RIBS is an incremental backup system written in PHP which utilizes some common *nix programs (specifically rsync, ssh and cp). Incremental backups mean frequent backups can be done (i.e. hourly) with only around 2x the space of the full backup. Using rsync means that RIBS can act as both a backup script on a local machine, or as a script to backup several network hosts. It is designed to be highly configurable and highly informative to the system administrator. There is a high amount of error checking, and logging/email capabilities.

* Download the latest version of RIBS here:
http://jcay.com/php/scripts-and-programs/server-management/ribs-rsync-incremental-backup-script.html

* tar -xzvf ribs-x.x.tar.gz
* cd ribs-x.x
* ./ribs.php example hourly

example is a part in Configuration part of ribs-x.x file. You can change this part and make your config.

bad interpreter: No such file or directory

I get the following message when I try to run a simple test script. The same script runs on another machine very similar to my own.

./myfile: /bin/bash^M: bad interpreter: No such file or directory

The file does has execute rights.

In Windows, the end of a line is CRLF (Carriage-Return, Line-Feed). In Unix-like systems, it is just LF. So when you try to run that script, every line has an extra CR on the end.

The way to fix this is to use some sort of utility to fix that. You might use the utility dos2unix if you have it installed. You can install it by typing:

apt-get install tofrodos

Monday, October 8, 2007

Logging as “root” in Ubuntu

if one really wants to enable the GUI “root” login (not recommended, think again!), following command can be used:

gksu gdmsetup

A GUI opens. In the security tab, there is an option which can be used to allow local system administrator login. The option needs to be checked in order to allow the “root” login. I highly recommend you not to do so and if you are keen to do so, do not let it to remain that way and bring the system to its default state AS SOON AS POSSIBLE.