Categories
Computers Linux

Re-disabling the root password

Sometimes it doesn’t help to think twice. The other night I was changing my password on an Ubuntu system and realised too late that I was right then root after having run ‘sudo su’. So, instead of changing my own password I changed the password of the root account. By default it is not possible to log onto the system by using the root account but by changing the password I immediately lowered that bar.

So how to fix this?

Some sources say that ‘sudo passwd -l root’ is the way to go but this just locks the account. Others point to ‘sudo passwd -d root’ but that just removes the password completely. While this means that it will not be possible to log onto the system remotely since ssh prevents logons using blank passwords, it does mean that the system is wide open to anyone who can gain access to a console.

The correct method is ‘sudo usermod -p ! root’. This inserts an exclamation point in the password hash for the root account. This means that no entered password will ever match the stored hash.

Categories
Computers Linux Mac Windows

Clearing the local DNS cache

On Mac OS X
Type “sudo nslookupd -flushcache”

On Linux
DNS records are not cached locally unless you have installed a local DNS server. Intead DNS records are cached in the upstream DNS servers.

On Windows
Type “ipconfig /flushdns”

Categories
Computers Linux Mac Windows

Getting out of Sharepoint

I have been using Sharepoint at work for a number of years now. In theory, it is a good product that takes away some of the anarchy that usually is the result of a just using a file share to exchange documents. In practice the benefits are less stellar, especially in a mixed environment.

Since starting to use a Mac in what is otherwise a Windows shop, it has become painfully obvious how much one ties oneself into the Microsoft world by using Sharepoint. People might be concerned about being locked in to Office but that is nothing to Sharepoint. Unless you run the combination of Windows, Office and Internet Explorer you are in for a rocky ride indeed.

So, trying to get out of Sharepoint, what do you do? You may still have a lot of documents saved there that you don’t want to lose.

I tried using wget but it wouldn’t download everything. I then tried httrack but it wouldn’t follow links into subfolders in document libraries (I did keep a copy downloaded by httrack though since it managed to keep most of the contents). I also tried to map UNC paths to the document libraries to be able to copy the documents that way. Didn’t work. I tried various freewares that were supposedly able to archive documents from Sharepoint. Not so.

Then I tried Sharepoint Documents Exporter by Brennan Stehling and that did the trick. Finally, I got a complete set of files directly from the MSSQL server, including files saved on the users’ private pages.

Thanks Brennan!

Now the big question remains: Should I head back to the file share or is there some open source Sharepoint wannabee solution with support for multiple client platforms, full browser compatibility and support for both Office and OpenOffice? Drop a comment if you have a suggestion.

Categories
Computers Linux

Fix for APT on Voyage Linux

When running apt-get on a system with Voyage Linux you may get the following error:

debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 75.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype

To fix this just install a fix by running the following:

apt-get install dialog apt-utils

Categories
Computers Linux Mac

Ping with timestamp

For some reason standard ICMP utilities (e.g. ‘ping’) do not support formatting the output in a way that makes it easy to do further processing. The following Perl script should work on any Mac or Linux system. It wraps the standard ping command and formats the output as comma separated values that can be directly imported into for instance Microsoft Excel.


#!/usr/bin/perl

use strict;
$| = 1;

my $host = $ARGV[0];
open PING, "ping $host |" or die "Error :$!";

while() {
 if($_ =~ m/.*seq=(\d+).*time=([\.0-9]*).*/) {
  my($s,$m,$h,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
  my $dt = sprintf("%4d-%02d-%02d,%02d:%02d:%02d", $year+1900, $mon+1, $mday, $h, $m, $s);
  print "$dt,$1,$2\n"
 }
}

Download script.

Categories
Computers Linux Mac

Version control a Rails application with SVN

I have been looking at Git for version control but so far I am using SVN. Whenever I set up a new Rails application and add it to my version control system I do the following to ignore files that should not be version controlled.

  1. Copy the entire project to a folder within my SVN working folder hierarchy
  2. Remove all superfluous files:

  3. rm tmp/*/*
    rm log/*
    rm `find . -name '.DS_Store'`
    rm `find . -name '*.sqlite3'`
    rake db:migrate VERSION=0

  4. Add all files (svn add *)
  5. Set properties on the Rails folders to ignore certain files

  6. svn propset svn:ignore "*.log" log/
    svn propset svn:ignore "*" tmp/sessions tmp/cache tmp/sockets
    svn propset svn:ignore "*.rb\n*.sqlite3" db
    svn propset svn:ignore ".DS_Store" .

  7. Make an initial commit (svn ci -m “Initial import”)
Categories
Computers Linux

Upgrade Ubuntu 6.10 (Edgy) after End-of-life

As of April 25th Ubuntu 6.10 (a.k.a Edgy Eft) is no longer supported. Any attempt to update the software from the standard repositories will therefore result in broken links.

To be able to upgrade the system the first task is to update the system to 7.04 (Feisty Fawn). This is done by replacing all instances of ‘edgy’ in the file /etc/apt/sources.list with ‘feisty’. This can be done manually using a text editor of choice or by running the following command.


sudo sed -e 's/\sedgy/ feisty/g' -i /etc/apt/sources.list

After that it should be possible to run ‘apt-get update’ followed by ‘apt-get dist-upgrade’ to upgrade the system to 7.04. Once there it is possible to use the standard method of upgrading to newer releases:


sudo apt-get install update-manager-core
sudo do-release-upgrade

During the upgrade process you will have to answer questions on what to do with files which have been edited. Run the above multiple times to upgrade to the newest version. It is possible to check the current version by running ‘cat /etc/issue’.

Categories
Computers Linux

Install Pure-ftpd

pure-ftpd icon

It should be very simple to set up an FTP server on a Linux server but for some reason I always seem to have an issue with it. The first question is which daemon to install when there are so many. The main three contenders seem to be pure-ftpd, proftpd and vsftpd but even choosing between them can be daunting.

Many (if not all) FTP servers seem to have been written with the intent to either providing FTP access for people with shell accounts on the FTP server or for anonymous users. I have no interest in anonymous access and the only one with local account that need file access is myself and I much prefer to use scp via Cyberduck instead. So my requirement for a pure virtual FTP server is usually not mainstream and I invariably find myself lost in all configuration descriptions.

Here is a simple step for setting up pure-ftpd on a Debian system and add an account:

  • Install the server [apt-get install pure-ftpd]
  • Create an FTP group [groupadd ftp]
  • Create an FTP user [useradd -g ftp -d /dev/null -s /etc ftp]
  • Create a folder to hold the FTP data [mkdir /var/ftp]
  • Change owner on the folder [chown ftp:ftp /var/ftp]
  • Add a pure-ftpd user [pure-pw useradd testuser -u ftp -d /var/ftp -N 300]
  • Save the changes [pure-pw mkdb]
  • Run the server [/usr/sbin/pure-ftpd -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb &]

To start the server automatically, use xinetd and add the following to /etc/xinetd.d/ftp:

service ftp
{
socket_type = stream
server = /usr/sbin/pure-ftpd
server_args = -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb
protocol = tcp
user = root
wait = no
disable = no
}

Then restart xinetd (/etc/init.d/xinetd restart).

Categories
Computers Linux

Ping utility with timestamping

Ping is no doubt one of the world’s most wide-spread applications. It is even so common that most people that use it probably don’t even know that they don’t actually “ping” the remote host. What they do is to send ICMP Echo requests and wait from replies.

Despite being great for what it does the standard GNU ping utility (or the Windows application for that matter) fails to record the time when the ping was sent and the output is in some quasi readable format that is not trivial to import into some application.

This Perl script wraps the Linux/UNIX form of the ping utility to output the sequence number and the round trip time as comma separated values. It also prepends each line with the current date and time so that the output can be imported into a spreadsheet to create a graph of the round trip time over time.

N.B. This perl script will not work on Windows since the output format differs from that on Linux/UNIX.

Attachments

Categories
Computers Linux

Installing Voyage Linux on ALIX 2c0

As I wrote earlier, I have bought myself an ALIX 2c0, a smallish embedded computer. It is designed and manufactured by PC Engines and has the following specification:

  • 433MHz AMD Geode CPU
  • 128MB RAM
  • Compact flash slot for storage
  • 2 mini-PCI slots for WiFi or other uses
  • One serial port that is uses as console but can be reconfigured (although limited in functionality

There are number of distributions that could be used on this system. I found Voyage Linux to be the most interesting since it includes the standard Debian package manager. This means that it is effortless to install additional applications.

To get Voyage Linux onto the ALIX I did this (using another computer running Linux):

  1. Download Voyage Linux 0.5.0 or later from the Voyage Linux web site
  2. Untar the archive [ tar –numeric-owner -jxvf voyage-0.5.0.tar.bz2 ]
  3. Change directory [ cd voyage-0.5.0 ]
  4. Create a directory where the compact flash disk can be mounted [ mkdir /mnt/voyage ]
  5. Insert the compact flash disk and check which device name it gets (N.B. be absolutely certain that you get this correct or you may end up wiping your hard drive) – This instruction assumes that the compact flash disk is /dev/sda
  6. Run the script [usr/local/sbin/format-cf.sh /dev/sda] within the downloaded and unzipped archive. This will initialise the compact flash disk – Again, please verify which device name corresponds to the compact flash disk on your system
  7. Run the script [usr/local/sbin/voyage.update]

The script will go through the installation and ask questions. Most of the options will be correct so it is mostly a matter of pressing enter a number of times. What you will want to change is the following:

  • The target profile should be set to “4 – ALIX” instead of “7 – WRAP” which is the default
  • The target disk should be set to whatever device is your compact flash disk (e.g. /dev/sda) – PLEASE check the correct device name on your system or risk wiping your hard drive, but on the other hand if you didn’t heed my warning earlier your disk is already toast.
  • The drive where the compact flash disk should be mounted should be set to the folder created above (e.g. /mnt/voyage)

At the end you will be faced with a summary of all the settings. Check that it is correct and then type “y” to continue. The copying will take a minute or two, after that the compact flash disk is ready. Just place it in the ALIX, connect it to your network and boot.

The system will automatically use DHCP to get an IP address. It can be reached by SSH with the default root password of “voyage”.

css.php