Remotely make the computer beep on built-in speaker

Try:

sudo sh -c "echo -e '\a' > /dev/console"

You may have to load the kernel module for the built-in speaker first (e.g. if the module was blacklisted from auto-loading):

sudo modprobe pcspkr

first:

modprobe pcspkr

then solutions from topic, like

ssh user@host
beep

From the beep man page on my Ubuntu machine:

IOCTL WACKINESS

Some users will encounter a situation where beep dies with a complaint from ioctl(). The reason for this, as Peter Tirsek was nice enough to point out to me, stems from how the kernel handles beep’s attempt to poke at (for non-programmers: ioctl is a sort of catch-all function that lets you poke at things that have no other predefined poking-at mechanism) the tty, which is how it beeps. The short story is, the kernel checks that either:

  • you are the superuser

  • you own the current tty

What this means is that root can always make beep work (to the best of my knowledge!), and that any local user can make beep work, BUT a non-root remote user cannot use beep in it’s natural state.

This could well be the reason why beep refuses to work remotely. You can check if this is the root cause by invoking ssh with the -t option, which forces pseudo-tty allocation.

A less desirable solution would be to create a wrapper script that executes beep, and grant this script root permissions. If executing this script over ssh duly produces a beep, you'll know that the issue is the lack of a controlling terminal.