How to change the text of “permission denied” in Linux?

Solution 1:

These messages come from the C standard library, namely strerror. Where they are depends on the C library your distribution uses, and possibly also on the distribution.

On Debian, with glibc, they are under /usr/share/locale in the libc.mo files, as part of the libc-l10n package.

To change them, you will need to build your own custom version of the C library, install it, and keep it up to date.

This is going to be a lot of work, have fun.

Also, the English messages are standardized by POSIX. This means everyone who knows Unix will expect "Permission denied" and will get utterly confused when reading "Try as root" instead. In particular because in many cases you might actually want to put proper permissions into place, and not "try as root".