glennji.com

Because breaking things is much more fun

Tips and Tricks

Stuff I've stumbled upon that turned out to be quite handy.

Detecting USB media players (Rhythmbox, Banshee, Amarok)

The GNU/Linux music players can detect USB devices as media-players and playback from them, just by adding a little metadata to the devices' filesystem. Create a file in the root of the filesystem named .is_music_player with the following content:


audio_folders=Music/

Restart Rhythmbox, Banshee or Amarok and you're done!

Oct 29

Mount an ISO as a DVD drive

To mount an ISO image, use the loopback device:

sudo mount -o loop somedvd.iso /media/fakedvd

Now you can point any DVD programs at /media/fakedvd rather than /dev/dvd, for example.

May 12

Streaming audio with MPD and Icecast

Using MPD and Icecast, it's easy to create a personal streaming radio station of your own music. Click here to find out how!

There should be distribution packages for both MPD and Icecast. Install them!

sudo aptitude install mpd
sudo aptitude install icecast

Now edit the /etc/mpd.conf file and add the following audio_output (leave any existing audio_output sections alone.

audio_output {
type “shout”
name “Icecast Stream”
host “localhost”
port “8000?
mount “/mpd.ogg”
password “youricecastpassword”
bitrate “96?
format “44100:16:1?
}

Now edit the icecast configuration at /etc/icecast2/icecast.xml.

May 12

Password-less logins with PAM

Sometimes you want certain to be able to log in to certain user accounts without a password -- for a guest account, for example. It's not terribly secure, sure, but sometimes you don't need that security. Read on for how to do this on any GNU/Linux OS that uses PAM and GDM.

To enable password-less logins for any operating system that uses PAM and GDM, edit /etc/pam.d/gdm to add the following line:

   auth    sufficient      pam_listfile.so sense=allow file=/etc/passwordless item=user
   
   @include common-auth
   ... 

Then create the /etc/passwordless file (readable only by root). List each user you want to login without a password, one per line.

If you are using the GDM autologin feature, add the line "@include common-pamkeyring" to /etc/pam.d/gdm-autologin. I haven't tried it, but this is reported to allow the no-password user wireless access without entering the keyring password.

If not, you need a script like the following to your session startup:

   #!/bin/sh
   exec echo -n "MyKeyringPassword" | /usr/lib/libpam-keyring/pam-keyring-tool -u -s

However, pam-keyring-tool is not included in Ubuntu 7.10, so you need to compile it.