PAM_KEYRING: Automatic Keyring Authentication

Posted by gmendoza on June 21, 2007 under Tech Tips | 24 Comments to Read

WARNING! THIS POST HAS BEEN MARKED AS OUTDATED!

While there may be useful information still contained within the article, there may be other more relevant articles out on the Internet. Please pay close attention to version numbers of software that this article refers to. If you're not careful, you could break your system if you do not understand what you are doing. If you would like to see this article updated, please contact the site administrator using the Contact page. Thanks!

UPDATE (11-03-2008): These instructions are no longer applicable to Ubuntu version 8.10 and higher. The latest versions of Ubuntu allow you to use a blank password for your keyring, which will allow user accounts automatically logged in by GDM to access the keyring.

If you are not using the the GDM auto login feature, simply make sure your keyring password is the same as your login password, this way it is automatically unlocked for you. The keyring passwords are now easy to change from “Applications… Accessories… Passwords and Encryption Keys… Edit menu… Preferences… Password Keyrings.” Highlight the “login” entry, and use the “Change Unlock Password” button.

The original instructions below ONLY apply to versions previous to Ubuntu 8.04.

ORIGINAL POST:
If you would like to avoid having to type in a password to access your gnome keyring, then you are in luck. To quote from the authors web site, “PAM_KEYRING is a pam module that launches the gnome-keyring-daemon and then unlocks a keyring using your login password.”

In Ubuntu 7.04, this comes in handy when using Network Manager to connect to your wireless network. Typically users are prompted for the “master” password to their keyring manager immediately after logging on to gnome, and this can become tedious. Installing and configuring PAM_KEYRING is a snap.

1. Install libpam-keyring from universe repositories.

$ sudo apt-get install libpam-keyring

2. Add the pamkeyring module to /etc/pam.d/gdm

$ echo "@include common-pamkeyring" | sudo tee -a /etc/pam.d/gdm

UPDATED: (10/25/2007)
With the release of Ubuntu 7.10 Gutsy, libpam-keyring is no longer needed, as this feature has been built by default in with the package “libpam-gnome-keyring”.

UPDATED: (04/21/2008) – For GDM Auto-Login Users

Sorry for not updating this post sooner. I helped someone else with this offline a while back. Here’s an excerpt from my email. It works well with Ubuntu 7.10 Gutsy, and “should” work with Hardy, unless there’s been some major changes with the libpam-gnome-keyring package that I don’t know about.

The auto login feature of GDM relies on the GDM processes ability to run Gnome as your user account, but it does not have to know the password, as it’s using an “su” command to accomplish the magic.

There lies the problem. The keyring uses the password supplied by the user to unlock itself, and being that no password is supplied to pam, it cannot unlock the keyring.

From a useful bug report, one fellow outlined how he has always done it previously using a login script. He used a tool called “pam-keyring-tool” included with the libpam-keyring package. The new libpam-gnome-keyring package does not include this binary, so in order for this to work, you need compile it from source.

I’ve successfully got it working using the following procedures:

Step 1: Download latest pam_keyring source code. I like to place all source code in /usr/src/:

cd /usr/src/
sudo wget http://www.hekanetworks.com/opensource/pam_keyring/pam_keyring-0.0.9.tar.gz

Step 2: Unpack source code

sudo tar zxfv pam_keyring-0.0.9.tar.gz

Step 3: Install prerequisites

sudo apt-get install build-essential libglib1.2-dev libglib2.0-dev
sudo apt-get install libtool libgnome-keyring-dev libpam0g-dev

Step 4: Compile and Install

cd /usr/src/pam_keyring-0.0.9
sudo ./configure --prefix=/usr
sudo make
sudo cp src/pam-keyring-tool /usr/bin/

Note: I’m not doing a “make install” because I only want this binary to be installed and nothing else)

Step 5: Test binary

/usr/bin/pam-keyring-tool --help

If you get a nice usage menu, you’ll see what the tool options are, and your compilation is complete.

Step 6: Create login script called “unlock-keyring.sh”.

Since the file will contain your password in clear text, you’ll want to keep it in your home folder, readable only by your user. Yes… I know this is lame.

mkdir ~/scripts
sudo chmod 750 ~/scripts
touch ~/scripts/unlock-keyring.sh
sudo chmod 750 ~/scripts/unlock-keyring.sh
sudo gedit ~/scripts/unlock-keyring.sh

Add the following to the script:


#!/bin/bash
echo "PASSWORD_HERE" | /usr/bin/pam-keyring-tool -u -s

Step 7: Add the script to your gnome session startup scripts

System -> Preferences -> Sessions

Under Startup Programs, add a new entry that will appear first in the list. e.g. “1-unlock-keyring”

The command will be:
“/home/USERNAME_HERE/scripts/unlock-keyring.sh”

Step 8: Ensure your /etc/pam.d/gdm-autologin is set to it’s defaults. This was the default Gutsy 7.10 version for reference.

#%PAM-1.0
auth requisite pam_nologin.so
auth required pam_env.so readenv=1
auth required pam_env.so readenv=1 envfile=/etc/default/locale
auth required pam_permit.so
@include common-account
session required pam_limits.so
@include common-session
@include common-password

Step 9: Restart GDM or simply reboot.

I really hope this helps you guys out.

Creative Zen V Plus in Ubuntu

Posted by gmendoza on June 14, 2007 under Tech Tips | 9 Comments to Read

WARNING! THIS POST HAS BEEN MARKED AS OUTDATED!

While there may be useful information still contained within the article, there may be other more relevant articles out on the Internet. Please pay close attention to version numbers of software that this article refers to. If you're not careful, you could break your system if you do not understand what you are doing. If you would like to see this article updated, please contact the site administrator using the Contact page. Thanks!

Update: 04/22/2009

The following post is pretty outdated, and while it’s still relevant, I do not use Gnomad2 any more. I prefer other applications such as Banshee, Rythmbox, and Amarok. Banshee is by far my favorite because of it’s simplicity, clean interface and album art support. KDE users will probably prefer Amarok, and Rhythmbox is by far the simplest. All of these devices have MTP and iPod support, and are available in virtually every distribution repository.

Original Post:

If you would like to get your Creative Zen V Plus or related portable music player working in Ubuntu 7.04 and above, you’re in luck!

All you need is “Gnomad2″ (please see updated notes at the top of this post) as the graphical front end to your players music and playlists, and several libraries that are installed as dependencies (i.e. libmtp5). MTP stands for Microsoft Transfer Protocol, and libmtp5 is the key component to making this work.

As of this writing, the Creative Zen V Plus was not added to the libmtp5 udev rules file. This means that you would need root privileges to run Gnomad2, unless you changed the default permissions. No worries… correcting this is very easy to do.

1. First, install “Gnomad2″. The required dependencies will be installed by default.

sudo apt-get install gnomad2

2. To allow access to the Zen player using your normal user account, you must specify which permissions the device should have applied to it. These permissions can be set easily in a file supplied with the libmtp5 package. Edit the file as shown below.

sudo gedit /etc/udev/rules.d/65-libmtp.rules

Simply add the following and save your changes:

# Creative Zen V Plus
SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4152", SYMLINK+="libmtp-%k", MODE="666"

Note: You may need to verify that the “idProduct” variable matches your device Product ID. To obtain this information perform an “lsusb” after plugging in the Zen player. The output will look like the following:

sudo lsusb
Bus 005 Device 007: ID 041e:4152 Creative Technology, Ltd
<snipped for brevity>

In the above example, “041e” represend the Vendor ID (Creative), and the second number to the right, “4152” is your Product ID (Zen V Plus). If your device is different, simply change the values accordingly.

3. Re-plug your Zen player and wait for it to fully initialize to it’s final on-screen display. Start Gnomad2, and have some fun!

For more information on how to use Gnomad2, check out their website: http://gnomad2.sourceforge.net/

Ubuntu Linux + Dell Wireless 5700 CDMA/EVDO Card

Posted by gmendoza on June 3, 2007 under Tech Tips | 29 Comments to Read

WARNING! THIS POST HAS BEEN MARKED AS OUTDATED!

While there may be useful information still contained within the article, there may be other more relevant articles out on the Internet. Please pay close attention to version numbers of software that this article refers to. If you're not careful, you could break your system if you do not understand what you are doing. If you would like to see this article updated, please contact the site administrator using the Contact page. Thanks!

UPDATE (11-04-2008): NetworkManager 0.7 has been introduced with Ubuntu 8.10. This major overhaul includes native support for Mobile Broadband card as shown in the screen-shots below. The great news is that virtually all CDMA cards work right out of the box with no configuration necessary. Thank you, NetworkManager developers! I suggest upgrading to the latest version of Ubuntu, or use the NetworkManager PPA or SVN to at least upgrade to version 0.7.

ORIGINAL POST: Great news! The internal Dell Wireless 5700 Mini PCI Express Card for use with CDMA/EVDO networks is very easy to get working with Linux. The following tutorial was written for Ubuntu 7.04 (and works with 7.10 Gutsy), but the procedures are essentially the same for most Linux distributions. Please consult with your distribution documentation to assist with any differences.

Here’s how to get it going. Read more of this article »