====== How to make graphical applications work with sudo ? ====== If you use <color red>sudo</color>, you may have noticed that, with Fedora Core 5, you just can't exec a graphical application as root (for example) if you haven't actually logged in as root in your X environment (you never do that ! Do you ?). You have probably encountered this type of message : <code console> $ sudo kcalc Xlib: connection to ":0.0" refused by server Xlib: Invalid MIT-MAGIC-COOKIE-1 key kcalc: cannot connect to X server :0 </code> To be able to launch a graphical application as root, the <color blue>XAUTHORITY</color> environment variable must be copied to the shell launched by <color red>sudo</color>. Just run: <code console> $ sudo visudo </code> This will open the <color green>/etc/sudoers</color> file. After "_XKB_CHARSET", just add "XAUTHORITY". This should now look like : <file> Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \ LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \ LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \ LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \ _XKB_CHARSET XAUTHORITY" </file> Now, you can try: <code console> $ sudo kcalc </code> It'll work ! ~~META:date created = 2006-09-17 02:44:00~~

 
blog/how_to_make_graphical_applications_work_with_sudo.txt · Last modified: 08/03/2010 13:25 (external edit) · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki