Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to restrict users so that they cannot output sound from built-in speakers. They should plug their headphones to hear any sound. They should be able to control headphone volume level, but not built-in speakers.

I need a command-line solution for automation purposes.

Is this possible (on Ubuntu 12.04)?

share|improve this question
Are the speakers and headphones on separate channels? – Ignacio Vazquez-Abrams Jun 1 '12 at 15:23
@IgnacioVazquez-Abrams: with current hardware: yes, this is pretty common. Not sure how it exactly works, but I think it is basically supported by multiple sound cards (which cost next to nothing nowadays when integrated in the motherboard). – jippie Jun 1 '12 at 16:47
@jippie: Except the driver can override this, switching between them as headphones are plugged in. So while the hardware may support it, the configuration may not. – Ignacio Vazquez-Abrams Jun 1 '12 at 16:49
I think that is exactly the problem with solving this question. – jippie Jun 1 '12 at 16:52
That requires some drivers i guess .. but OpenBSD seems to have the ability to detect if a Jack is plugged in – warl0ck Jun 2 '12 at 5:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.