There are a number of ways to do this.
The simplest is just to use su - root and then run the command.
The way RedHat does it is they symlink the program name to consolehelper in /usr/bin They then have a file in /etc/security/console.apps called the name, redcarpet, of the program that contains something like
So that when when you run redcarpet it really runs consolehelper that realizes you want to run redcarpet. It looks in the file, finds the correct path, gives you a prompt and if correct executes it as root for you.
If you are using an alternative form of authiecation, aka something other than passwd/shadow, then you will probably also want to setup a /etc/pam.d file called the name of the program.
You shouldn't have problems with X permissions when doing either of the above, but if you do you can use xhost +localhost to give all local users permission to open things to the current X session.