Limiting root access in HP-UX CDE

PROBLEM DESCRIPTION


When using HP-UX CDE,  would like to disable remote login as root user.



RESOLUTION


When using CDE in HP-UX, you cannot completely block remote login as root user. However, when the CDE session is running, we can edit /usr/dt/bin/Xsession with the following lines to limit remote login as root.
#!/usr/bin/ksh
if [ "$USER" = "root" ] && ([ "$DISPLAY" != ":0" ] || [ "$DISPLAY" != "unix:0" ] || [ "$DISPLAY" !="UNIX_HOSTNAME:0" ])
then
exit
fi