I'm working through a Linux textbook, and it's telling me about devices. It says that if I send the appropriate output to /dev/dsp, then it will play a sound. The example is cat file.wav > /dev/dsp, where file.wav is just any .wav file.

When I do this I get permission denied. If I run this with sudo I still get permission denied. If I su first, no sound plays.

Why do I get permission denied with sudo? Why does no sound play even with su?

  • 1
    Make sure your user is in the audio group. Dec 4, 2013 at 22:10
  • You might also need to ensure that your wav file is raw audio - not all .wav files are raw. Dec 4, 2013 at 22:27
  • @DrakeClarris, that would cause noise to be output, not a permission denied error.
    – cjm
    Dec 4, 2013 at 22:56
  • @cjm I was thinking more of the silence when playing using su Dec 5, 2013 at 16:51

3 Answers 3


/dev/dsp is part of OSS, which hasn't been part of the Linux kernel in... a very long time. It has long been supplanted by ALSA, which uses different devices, different programs, and a different API.

There is an emulation layer module though. If it is available then loading the snd-pcm-oss module will enable you to use the PCM devices for OSS such as /dev/dsp.

Or just stick to piping data to aplay or paplay instead.

  • 2
    sudo modprobe snd-pcm-oss works on my ubuntu to load that module. I get a /dev/dsp1 and a /dev/dsp2 out of this.
    – Veda
    Mar 14, 2017 at 8:25
  • How do you load the snd-pcm-oss module? On Ubuntu 18.04, when I run sudo modprobe snd-pcm-oss, I get error: modprobe: FATAL: Module snd-pcm-oss not found in directory /lib/modules/4.15.0-169-generic Mar 12 at 7:20

If I run this with sudo I still get permission denied.

By this statement, it sounds like you are trying a command like:

sudo cat file.wav > /dev/dsp

The reason you continue to get "permission denied" is that your shell first tries to open the /dev/dsp device for output, before running the command (which is sudo). To have the shell open the redirection with root privileges, you would have to do something like:

sudo sh -c 'cat file.wav > /dev/dsp'

Out of date book, as noted.

So to make the examples work with more modern linux, where it says something like

cat music.wav > /dev/dsp

change it to:

cat music.wav | aplay
# or
aplay music.wav
  • Examples you can test on Ubuntu 18.04+, for example: cat /usr/share/sounds/alsa/Front_Center.wav | aplay or aplay /usr/share/sounds/alsa/Front_Center.wav Mar 12 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.