acccheck
Check accessibility of files and directories
SYNOPSIS
acccheck
DESCRIPTION
acccheck is a minimal Linux utility designed to verify if the calling process has permission to access the virtual console, specifically by attempting to open /dev/tty0 for reading and writing. It returns exit code 0 on success (access granted) and 1 otherwise, making it ideal for scripts that need to conditionally apply console-specific configurations.
This command plays a key role in console management tools, preventing unwanted changes during remote sessions like SSH. For example, in Debian-based systems, it's used by console-setup and kbd-mode during boot or on virtual terminals (VTs) to set keyboard layouts, fonts, or modes only when running on the physical console.
Due to its simplicity, acccheck has no command-line arguments or options, ensuring fast execution even in resource-constrained environments. It relies on the system's permission model, and in some packages, it may be installed setuid root to accurately detect console ownership. Developers and sysadmins use it in init scripts, PAM modules, or display managers to enforce console-only behaviors.
While straightforward, improper use in non-console contexts can lead to unexpected denials, highlighting its niche but critical purpose in multi-user, multi-session Linux setups.
CAVEATS
No options available; solely checks /dev/tty0 access.
May require setuid root privileges in certain packages.
False negatives possible if console is locked or in use.
EXIT STATUS
0: Console access granted
1: Access denied or error
FILES
/dev/tty0: Virtual console device checked for r/w access
HISTORY
Developed for Debian's console-setup package circa 2005 to enable safe console reconfiguration. Integrated into other distros via kbd or console tools; remains stable with minimal changes due to its focused design.


