Manage console owner for all virtual console logins
The "console owner" is a user logged in on a local console who has exclusive access to local physical resources like removable media and audio devices. When virtual consoles are enabled to allow multiple local logins, there is still only one console owner. This is indicated by ownership of the console device node in /dev/console or /dev/vt/<number>. /dev/vt/console_user is a symlink which always points to the VT of the console user. The VT_GET_CONSUSER ioctl is also designed to return the VT # of the console user.
The current policy appears to be to set the first user to log in locally as the console owner (who becomes the next console owner if the user logs out?).
We are currently updating the console owner in GDM (presumably via VT_SET_CONSUSER) for X sessions, but not for text logins. This needs to be fixed. This may need to account for future changes of "console owner" policy.