Azimout's Linux weblog

Archive for the ‘Reference’ Category


leave a comment »

Here’s how to install and configure an ftp server (proftpd) on a Ubuntu machine.

sudo aptitude install openbsd-inetd proftpd-basic (tell it to start from inetd, not standalone)
sudo vi /etc/proftpd/proftpd.conf (change ServerName)

System users (i.e. the ones that have an entry in /etc/passwd) can login to proftpd by default, with their system password; they will land in their home directory. To add “virtual users” (i.e. ftp-only users), do:
ftpasswd --passwd --shell=/bin/false --uid=502 --name=username --home=homedir --file=/etc/proftpd/ftpd.passwd (choose username, homedir)
Then add the following line to /etc/proftpd/proftpd.conf:
AuthUserFile /etc/proftpd/ftpd.passwd

To allow your user(s) to upload files, just modify the homedir’s permissions.


Written by azimout

14/07/2010 at 21:50

Posted in Reference

cups web interface

leave a comment »

CUPS (Common Unix Printing System) was released by Apple in 1999 and is used by practically all Linux distros. In addition to using system-config-printer you can administer your print system from its web interface, accessible on port 631. Just type http://localhost:631/ in your browser. You can view the status of your print server without authenticating yourself.

If instead you want to administer the print server (add/remove printers, cancel print jobs, etc), you need to login. Normally you’d use the root account and the corresponding password. However, the root account is locked in Ubuntu.

In theory, it’s enough to add your user account to the lpadmin group. If that’s not enough, add yourself also to the shadow group (sudo usermod -aG shadow username), and then sudo lppasswd -a username. Finally, modify /etc/cups/cupsd.conf, changing the DefaultAuthType to BasicDigest.

If you want to allow also other machines in your subnet to be able to control the cups server, modify /etc/cups/cupsd.conf and replace Listen localhost:631 with Port 631 and add Allow @LOCAL under <Location />


Written by azimout

09/07/2010 at 16:41

Posted in Reference

Transmission daemon

with one comment

If you want the transmission bittorrent client to run as a daemon, so you don’t have to stay logged in, here’s how:

  • sudo aptitude install transmission-daemon
  • sudo service transmission-daemon stop
  • sudo vi /var/lib/transmission-daemon/info/settings.json and modify “download-dir”, “rpc-username”, “rpc-password”
  • sudo service transmission-daemon start
  • go to http://localhost:9091/ and login

The .torrent files you had in transmission-gtk are stored under ~/.config/transmission/torrents/, just import them again.

Remember also to allow the user debian-transmission (transmission-daemon runs as this user) write access to the download directory.

You may also want to change “message-level” from 2 to 1 (from “info” to “error”), otherwise it kind of spams your syslog!

Configuration options reference:

Comment: I must say that the daemon is much less configurable than the gtk client: you can’t have different download directories for different torrents (for security reasons, I guess), no blocklists, no per-torrent options

Written by azimout

08/07/2010 at 14:33

Posted in Reference

Apache, Php, Redmine

leave a comment »

This is a step-by-step guide for installing apache, php, redmine and other webserver stuff on Ubuntu 10.04 Lucid Lynx.

Apache 2.2.15 + PHP 5.3.2

Install the required packages: sudo aptitude install apache2 libapache2-mod-php5. By default your site is under /var/www.

  • To avoid the “Could not reliably determine the server’s fully qualified domain name” error each time you restart apache2, edit /etc/apache2/apache2.conf (Ubuntu’s version of httpd.conf) and add a line with ServerName and then the FQDN of your webserver
  • To disable directory browsing in apache, edit /etc/apache2/sites-available/default and remove “Indexes” from “Options”.
  • Each time you make modifications to apache’s configuration, restart it with sudo service apache2 restart.


Redmine 0.9.4 + MySQL 5.1.48 + Subversion 1.6.12

Note: By default, redmine will use the sqlite3 database backend, which requires virtually no configuration. However if you want to use also svn with redmine, use mysql instead!

The way to get this to work (contrary to what the reference below says) is to install mysql-server before redmine!

  • sudo aptitude install mysql-server
  • sudo aptitude install redmine redmine-mysql libapache2-mod-passenger
  • run sudo ln -s /usr/share/redmine/public /var/www/redmine
  • add a line saying PassengerDefaultUser www-data in the file /etc/apache2/mods-available/passenger.conf
  • add the following lines to /etc/apache2/sites-available/default
<Directory /var/www/redmine>
    RailsBaseURI /redmine

The default admin account in Redmine is user:admin, password:admin. Log in and change that password IMMEDIATELY!

You can do the rest of the configuration from the web-based interface.


Written by azimout

24/06/2010 at 20:10

Posted in Reference

virus scanning LiveCDs

leave a comment »

Here’s a list of bootable Linux LiveCDs that will scan a Windows partition for viruses:

And here are a few older, discontinued ones:

  • LinuxDefender (BitDefender on Knoppix)
  • ClamAV LiveCD (ClamAV on Ubuntu, renamed to OpenDiagnostics)
  • Trinity Rescue Kit (used to be AVG-based, but that was broken, so they’re switching to Avast/ClamAV/F-Prot/Vexira, but nothing yet)

Written by azimout

19/06/2010 at 13:08

Posted in Reference

host name resolution

leave a comment »

I have 5-6 machines in my LAN, all running Linux (except for my iPhone). All have DHCP reservations on my router, so they always get the same IP.

I have edited the /etc/hosts file in all Linux machines to include the dictionary of all machines on the LAN (matching IPs to hostnames). However, if anything changes, I’d have to go an edit /etc/hosts on each single machine. So I thought there must be a better way to do this, and starting studying. Here’s what I’ve come up with:

  • in /etc/hosts you can add any IP-hostname pair you like (the Windows equivalent is LMHOSTS)
  • in /etc/resolv.conf there’s the nameserver (set by NetworkManager), which is the router. The router is not an actual nameserver, it just relays DNS requests to the ISP’s DNS server
  • in /etc/nsswitch.conf, under the entry “hosts:”, there’s the order according to which name resolution requests are resolved. By default it’s files mdns4_minimal [NOTFOUND=return] dns mdns4
  • Windows used to use WINS (a client-server architecture) for this sort of thing (NetBIOS name service, or NBNS). Names are not defined by the server, but instead clients register themselves and declare their names.
  • Samba can act (among other things) as an NBNS server

Written by azimout

27/05/2010 at 12:29

Posted in Reference


leave a comment »

I’d say the 4 main virtualization technologies for Linux are the following:

  1. KVM (RedHat)
  2. VMWare (EMC)
  3. VirtualBox (Oracle)
  4. Xen (Citrix)

The thing is, VMWare is proprietary, VirtualBox is proprietary if you want USB or RDP, and Xen requires a special kernel (rather than a kernel module, like KVM). So to me, the choice is easy…


  1. First, check if your CPU supports virtualization, and if it’s enabled in the BIOS (run egrep '(vmx|svm)' /proc/cpuinfo --colour, vmx means Intel VT-x, svm means AMD-V).
  2. Then, install some packages: sudo aptitude install qemu-kvm libvirt-bin virt-manager
  3. Regarding disk storage, you have storage pools and storage volumes. I use a directory-based pool and qcow2 volumes.
  4. The xml configuration files for each VM will either be under ~/.libvirt/qemu or under /etc/libvirt/qemu
  5. You really want to use virtio for better disk and network I/O performance
  6. To get a screen resolution > 800×600, change the video device from “cirrus” to “vga”
  7. To avoid filling up your main partition, create a virtual link for the directory countaining the virtual machine images: sudo ln -s -d path_to_folder /var/lib/libvirt/images

Virtio in Windows XP

  1. download the driver while in the VM
  2. shut down the VM
  3. add a (dummy) virtio storage volume to the VM
  4. run the VM
  5. it will ask you to install the driver; provide the driver downloaded in step 1
  6. shut down the VM
  7. remove the dummy volume, remove the actual IDE volume of the VM
  8. add a virtio volume pointing to the same file
  9. run the VM

Editing an image

To mount the guest image volume (.img) from the host (as long as the guest is NOT running), do the following:

  1. sudo losetup /dev/loop0 path_to_img_file
  2. sudo kpartx -av /dev/loop0
  3. sudo mount /dev/mapper/loop0p1 mount_point
  4. do whatever you want to do
  5. sudo umount mount_point
  6. sudo kpartx -dv /dev/loop0
  7. sudo losetup -d /dev/loop0

Resizing an image

Resizing (growing) an existing qemu machine image is trivial:

  1. Convert from qcow2 to raw format:
    qemu-img convert -f qcow qcow2_image -O raw raw_image
  2. Create an empty qemu image of the size that is the amount you want to grow your image:
    qemu-img create -f raw temp_image 10G
  3. Concatenate the two images to a new one:
    cat raw_image temp_image > new_image
  4. Convert the new image from raw back to qcow2
    qemu-img convert -f raw new_image -O qcow final_image
  5. Boot your virtual machine with the new image. Use (format) the empty disk space at will.


  • If you’re using raw images instead of qcow2, you can obviously skip steps 1 and 4.
  • I saw some people suggesting using the dd command to replace steps 2 and 3, but others are saying it’s slower. Haven’t tried it myself.
  • If you want to grow the root partition’s filesystem rather than create a new partition in the image, you can add the image to an existing Linux virtual machine and use gparted. Some are suggesting downloading the gparted livecd and booting a VM with that as a CD and your image as an HDD, then doing the resizing, shutting down and booting back into your normal VM.

Renaming a VM

  • Edit the corresponding .xml file under /etc/libvirt/qemu
  • sudo service libvirt-bin restart


Written by azimout

20/05/2010 at 19:06

Posted in Reference