• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1344
  • Last Modified:


Need some help with audio device in Solaris 2.4 running on sparc-10.
Using audioplay command in shell scripts to play warning sound under certain conditions.

# audioplay /usr/demo/SOUND/sounds/doorbell.au

Unless the script is run by root or the user who is currently logged in on the console then permission is denied for the audio device "/dev/audio". The audio device only has rw permission and is owned by the user who is logged onto the console.

# ls -l /dev/audio
lrwxrwxrwx   1 root     root          12 Feb  2  1997 /dev/audio -> /dev/sound/0
# ls -l /dev/sound/0
lrwxrwxrwx   1 root     root          42 Feb  2  1997 /dev/sound/0 -> ../../devices/audio@1,f7201000:sound,audio
# ls -l /devices/audio@1,f7201000:sound,audio
crw-------   1 <loginName>   sysadmin  28,  0 Feb  2  1997 /devices/audio@1,f7201000:sound,audio

The scripts are run by cron and cannot be run as root or as the user who is logged onto console.
The console login is always the same so to get round this for now I have added the following to the console login users .profile:
chmod g+w /devices/audio@1,f7201000:sound,audio.

However this will fail if the sparc is rebooted at any time without a login taking place on the console (a remote re-boot for example), as permission will be denied.

This is the question:
Is there any way to set the permissions of the audio device regardless of who logs into the console.
  • 3
  • 2
1 Solution
have you tried...
#chmod ugw+rw  /devices/audio@1,f7201000:sound,audio
I noticed that the character special is only read/write for root.
Imeant ugo (user group other)................
gormenghastAuthor Commented:
Hi rickyr

The permissions and ownership for "/devices/audio@1,f7201000:sound,audio" is dependent on who logged onto the console, and any change of permissions or ownership will only be valid while that person is logged on.
For example:
boot up sparc and login in locally

login: fredf
password: •••••••
# ls -l /devices/audio@1,f7201000:sound,audio
     crw-------   1 fredf   sysadmin  28,  0 Feb  2  1997 /devices/audio@1,f7201000:sound,audio
# chmod 666 /devices/audio@1,f7201000:sound,audio
# ls -l /devices/audio@1,f7201000:sound,audio
     crw-rw-rw-   1 fredf   sysadmin  28,  0 Feb  2  1997 /devices/audio@1,f7201000:sound,audio


login: barneyr
password: •••••••
# ls -l /devices/audio@1,f7201000:sound,audio
     crw-------   1 barneyr   sysadmin  28,  0 Feb  2  1997 /devices/audio@1,f7201000:sound,audio
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

>Is there any way to set the permissions of the audio device regardless of who logs into the console.

No.  Let me explain.  The audio device is a "speaker" housed in the main CPU box of the Sun machine.  And is considered part of the console - just like the keyboard, mouse and the display unit of the console.  That is the reason it is set to be owned by the user who is currently logged on to the console.

Imagine you telnet to the host via a network - miles away from the machine/console.  And if you play anything to the audio device, you can't hear anything, can you?

If your requirement is to play something to the audio device from a script run from crontab, you must be a root to change the permissions of the device and to 'write' to it.
Palying back to the console audio device from a cron job is not something I would like.  But then it may be is possible by some indirect way.

You can create another device node with the same major and minor device number as that of '/dev/audio' and use that device to play your audio files.

Find out device type and the major & minor device number of the audio device.
Do an "ls -l" to get this info.

From what you have posted, I see that your audio device is a charater special device with major number 28 and minor number 0(zero).
Now, create a new device with this info.
# mknod /devices/myaudio c 28 0
Set permissions to this device
# chmod 666 /device/myaudio

Use this device to play back your audio files in your scripts by
    audioplay -d /devices/myaudio <file>

Run your script as root, then su to the user that will run the script,
Then su to the user that will ding the bell.
then su to the user that runs the script, to carry on with the script.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now