?
Solved

/dev/audio

Posted on 1998-06-19
6
Medium Priority
?
1,340 Views
Last Modified: 2013-12-16
Hi
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.
0
Comment
Question by:gormenghast
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:rickyr
ID: 1812150
Hi....
have you tried...
#chmod ugw+rw  /devices/audio@1,f7201000:sound,audio
I noticed that the character special is only read/write for root.
regards
0
 
LVL 3

Expert Comment

by:rickyr
ID: 1812151
Sorry...
Imeant ugo (user group other)................
0
 
LVL 2

Author Comment

by:gormenghast
ID: 1812152
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

logout

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
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Expert Comment

by:seedy
ID: 1812153
>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.
0
 
LVL 2

Accepted Solution

by:
seedy earned 200 total points
ID: 1812154
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>

0
 
LVL 3

Expert Comment

by:rickyr
ID: 1812155
Hello...
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.
regards
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month15 days, 3 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question