Permissions & soundcard HowTo

Share your own howto's etc. Not for support questions!

Permissions & soundcard HowTo

Postby mark » 2004-04-07 14:59

When I surf the linux forums I always bump into the question; “My soundcard isn’t working when I’m a normal user but when I’m root it does. How can I solve this problem?”
This made me decide to write this little Howto about solving this problem.

The ‘problem’ is permissions. I willl give you some general information about permissions first, before we solve our little problem.
The linux system has a permissions system that helps to make the complete system more secure.
Every file and every directory (which is a file) has a ‘tag’ that doesn’t only contains the name of the file but also describes the permissions.
Lets take a look at the permissions.
Type:
Code: Select all
 ls -l

To see the contents of the present working directory. It can look something like this :
    drwxr-xr-x 2 mark users 88 Apr 4 12:06 Desktop
    drwxr-xr-x 3 mark users 72 Apr 4 14:03 backup
    drwxr-xr-x 3 mark users 72 Apr 6 22:09 docs
    drwxr-xr-x 2 mark users 80 Apr 4 23:51 images
The first column you see are the permission bits:
These characters, except the first one, which tells us what kind of file it is (in this case a “d” so it is a directory), tell us what the permissions are.

Lets take a look at -rwxr-xr-x
The first “-“ tells us it is a file and not a directory.
The next 3 letters rwx tell us that; the owner may read, write and execute the file.
The next 3 characters , r-x, tell us that; the group, where the file belongs to; may read and execute it.
And the last 3 characters, r-x, tell us that everybody else (not the owner or a member of the group) may read and execute it.

NOTE : When the x is in the permission bits of a directory it means that, permission is granted to see the contents of the directory. (A directory can’t be executed!)

The permissions can be changed with the chmod command.
I suggest you read the chmod man page by typing:
Code: Select all
man chmod


OK back to our little soundcard problem.
Now that you know that every file has permissions, you probably think:” I have to change the rights of the program that controls the soundcard.”
Right you are!
This program is: /dev/dsp.
Before we can change any rights we have to get root privileges. Type:
Code: Select all
$ su
password

Now that you have root privileges you could do:
Code: Select all
chmod 777 /dev/dsp

this would do the trick but it is not the best solution. If you done chmod 777 the permissions of /dev/dsp are: read, write and execute for every one. Execute the file is not a smart thing to do, so when you do use chmod, try chmod 666.

The best way to solve this, is to describe which users may use this file (soundcard) by making a group and make this group owner of this file (soundcard).
Normally the group for this purpose is called……audio.
First we have to find out if this group already exists on the system. We do this by typing:
Code: Select all
 # cat /etc/group | grep audio

if you get an output that looks something like this :
    audio:x:18:root,mark
Then the group already exists on your system. When not we have to make one. We do this by editing the /etc/group file:
Code: Select all
# nano /etc/group

and add the following line :
    audio:x:18:root,mark,… <-- Type the names of the accounts who may use the soundcard.
safe the file by typing CTRL-o and close the editor by typing CTRL-x

We have now made a new group with GroupID (GID) #18. You can choose any other number as long it isn’t in use already.
To this group belong: root and mark and …

Now we can make the ‘audio’ group owner of the /dev/dsp file. This can be done By typing:
Code: Select all
 # chgrp sound /dev/dsp


The last thing we have to do is give the needed rights to the ‘audio’ group. Type:
Code: Select all
 # chmod 660 /dev/dsp


This should have done the trick.

Logout and log back in. And there’s (or should be) sound!

Have Fun!

Mark van Deursen
mark
 
Posts: 37
Joined: 2004-02-15 22:28

Postby AndorabLe » 2004-10-06 20:01

Isn't is easier to use:
Code: Select all
adduser mark audio
AndorabLe
 
Posts: 2
Joined: 2004-10-06 19:46
Location: Netherlands

Postby Guest » 2004-10-18 10:48

Please ignore Mark van Deursen he doesn't know what hes talking about.:oops:


The proper way to do this is:


First, you have to load the driver for your sound card/chipset. If you don't know what sound chipset you have, try lspci. If you're in the woody installer, press Alt-F2 and try cat /proc/pci. Once you've identified the chipset, use modconf to load the appropriate driver. (The woody installer runs modconf for you during the installation.)

Some common chipsets: Sound Blaster Live! cards use emu10k1. Onboard VIA AC97 chipsets use the via82cxxx_audio driver. Onboard Intel i810 chipsets use the i810_audio driver. Legacy 16-bit ISA Sound Blaster cards use the sb driver.

Once you've loaded your driver, you must add yourself to the audio group by running adduser username audio. Log out and back in for this to take effect, or use su - $USER to launch a new shell with the new group membership.
Guest
 

Postby hugtux » 2004-10-25 07:53

I think Guest and Mark are talking about 2 different thinks:
The guest is explaining how to install the dsp and Mark is explaining the soundcard permissions.
hugtux
 
Posts: 19
Joined: 2004-03-04 11:28
Location: Belgium

Postby Guest » 2004-10-27 10:18

hugtux wrote:I think Guest and Mark are talking about 2 different thinks:
The guest is explaining how to install the dsp and Mark is explaining the soundcard permissions.


no mark is talking about how-tp mess up the permission in /dev/
Guest
 

Postby Guest » 2004-10-27 10:20

hugtux wrote:I think Guest and Mark are talking about 2 different thinks:
The guest is explaining how to install the dsp and Mark is explaining the soundcard permissions.


no mark is talking about how-to mess up the permission in /dev/. When things are wrongly done like this, it CAN cause a security leak. See for more information on the debian security/advisory list.
Guest
 


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable