Friday 9 August 2013

why cannot read /dev/console after reboot AIX

why cannot read /dev/console after reboot AIX

I use < /dev/console when running Micro-Focus cobol programs in background
cron jobs instead of < /dev/null because then we don't get an warning
about the input file not supporting ioctl. The warning about the input
file not supporting ioctl means that the script is not able to
differentiate between this and a real error as the program returns the
same value.
Usually (on many different AIX servers) I set up these jobs to run as root
because other users do not have permissions to read /dev/console.
Over several years, I've had several problems that I just don't
understand, and searching the internet for many hours hasn't helped. E.g.
1) a server changed, for no apparent reason, from where only root could
use < /dev/console to where only a non-root user could use < /dev/console
2) a server where a non-root user was able to use < /dev/console changed
after reboot so that only root could use < /dev/console
The 2nd example is my most recent case. lscons shows the console is
assigned to /dev/tty0 and you can login on /dev/tty0 fine. I don't think
anyone has used swcons or chcons to reassign the console before the
reboot.
I've tried changing permissions on /dev/console & /dev/tty0 to 666 but
still only root can do, without error: echo TEST < /dev/console
Does anybody understand what is happening or know how to change it so
non-root users can read /dev/console ?
Any suggestions for another device that supports ioctl and could be used
as a dummy stdin by non-root users? (I suspect that the cobol program only
opens stdin but doesn't actually read it when in the background).

No comments:

Post a Comment