Here’s what we came up with:
1. we have a beforeuserlogin script that edits a template server.cfg and replaces server.cfg.
2. The script reloads the config after mofifying server.cfg.
!/bin/bash
ip=$1
LOG=/tmp/nomachinebeforeloginscript.log
if [ “$ip” = “X.Y.Z.A” ]; then # this is our external gateway
echo sed ‘s/#%EnableClipboard%/EnableClipboard client/’ >> $LOG
sed ‘s/#%EnableClipboard%/EnableClipboard client/’ < /usr/NX/etc/server.cfg.template > /usr/NX/etc/server.cfg 2>> $LOG
echo “result code of sed is ‘$?'” >> $LOG
else
echo sed ‘s/#%EnableClipboard%/EnableClipboard both/’ >> $LOG
sed ‘s/#%EnableClipboard%/EnableClipboard both/’ < /usr/NX/etc/server.cfg.template > /usr/NX/etc/server.cfg 2>> $LOG
echo “result code of sed is ‘$?'” >> $LOG
fi
/etc/NX/nxserver –configupdate
echo “result code of nxserver is ‘$?'” >> $LOG
exit 0