Use the CD or DVD Device Icons in KDE

General Information

KDE can place icons for specific devices such as CD-Roms, DVD-Roms, Cameras, etc. The idea is to click on this icon and the device will automatically be mounted and Konqueror will open showing the contents of the mounted device.

By default only the root user, or superuser, has the ability to mount filesystems. Regular users need to be given the ability to mount if they are going to use the KDE Device Icons.

Requirements

  1. root access
  2. Working KDE install

Configuration

How to give users mount permissions.

Note: Make sure that you change “user1″ to be the username you are using.

Using the following command, add the line vfs.usermount=1 to your sysctl.conf file.

# echo "vfs.usermount=1" >> /etc/sysctl.conf

Changes to the /etc/sysctl.conf only take effect after a reboot; however, this setting can be made dynamically using the following command:

# sysctl -w vfs.usermount=1

The next task is to modify the CD devices. Atapi CD-Rom drives usually show up as the following:

/dev/acd0 <--- First drive

/dev/acd1 <--- Second drive

# ls -dl /dev/acd*
crw-r-----  1 root  operator    4,  12 Feb 15 11:34 /dev/acd0
crw-r-----  1 root  operator    4,  13 Feb 15 11:34 /dev/acd1

Note: If you see other devices such as /dev/acd0t01, you may ignore them.

Notice that the devices are in the operator group. Users will need to be members of the operators group in order to mount these drives. To make a user a member of the operators group, use the following command:

# pw usermod user1 -G operator

Use the following to make sure this has taken effect and that the groups are correct:

# groups user1
user1 operator

Note: This command will not change the primary group, but will change your user so that the only other group he is invited to be a member of is operator. If you want a user to be a member of both operator and wheel user the following command:
# pw usermod user1 -G operator,wheel
# groups user1
user1 wheel operator

Now give the operators group rw permission on acd0 and acd1.

# chmod 660 /dev/acd0 /dev/acd1

Users must mount CD-Rom drives to directories that they own. Directories must be owned by the user. Being a member of the group the directory belongs to is not enough.

Create a directory for each CD-Rom drive in the users home directory.

# mkdir /home/user1/cdrom
# mkdir /home/user1/cdrom1
# chown user1:user1 /home/user1/cdrom /home/user1/cdrom1

In order for KDE to mount CD-Rom devices to these directories, the filesystem type must be specified in the /etc/fstab file. Use the following commands to add the cd9660 filesystem type to these directories in /etc/fstab.

# echo "/dev/acd0       /home/user1/cdrom       cd9660  ro,noauto       0       0" >> /etc/fstab
# echo "/dev/acd1       /home/user1/cdrom1      cd9660  ro,noauto       0       0" >> /etc/fstab

Now all that is left is to create the CD-Rom devices for KDE. Use the following commands to create CD-Rom devices on the users KDE Desktop:

For /dev/acd0

# cat << EOF >> /home/user1/Desktop/CD
# [Desktop Action Eject]
# Exec=kdeeject %v
# Name=Eject

# [Desktop Entry]
# Actions=Eject
# Dev=/dev/acd0
# Encoding=cd9660
# Icon=cdrom_mount
# MountPoint=/home/user1/cdrom
# ReadOnly=false
# Type=FSDevice
# UnmountIcon=cdrom_unmount
# X-KDE-Priority=TopLevel
# EOF

For /etc/acd1

# cat << EOF >> /home/user1/Desktop/CD1
# [Desktop Action Eject]
# Exec=kdeeject %v
# Name=Eject

# [Desktop Entry]
# Actions=Eject
# Dev=/dev/acd1
# Encoding=cd9660
# Icon=cdrom_mount
# MountPoint=/home/user1/cdrom1
# ReadOnly=false
# Type=FSDevice
# UnmountIcon=cdrom_unmount
# X-KDE-Priority=TopLevel
# EOF

Now make user1 owner of the two file you just created.

# chown user1:user1 /home/user1/Desktop/CD1 /home/user1/Desktop/CD1

You should now see two CD icons on the users KDE Desktop. Insert a CD into one of your drives and click on the corresponding icon and it will mount and bring up a window showing you the contents of the CD.

Speak Your Mind

*