in reply to Simulating Keystrokes in Solaris/Linux

In addition to the Perl solutions already suggested, there's also this nifty little (non-Perl) program xdotool.  Like X11::GUITest, it relies on the X server extension XTEST (pretty common these days — use xdpyinfo | grep -i xtest to check if available).

It should be mentioned that you'll need an X development environment (header files) to build xdotool — those are typically distributed as X*-dev packages, to be installed in addition to the regular X server / Xlib packages.

BTW, security is handled the normal X way (auth cookies, or whatever the X server is configured to use).