Find the answer to your Linux question:
Results 1 to 5 of 5
I'm running Gentoo Stage 3 and I recently set up sudo so that any user using it can run any command I've run into a problem, though. If I try ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    Odessa, FL
    Posts
    586

    sudo problems


    I'm running Gentoo Stage 3 and I recently set up sudo so that any user using it can run any command

    I've run into a problem, though. If I try to run a gui-based program from a terminal with sudo, I get this error (in this case with kcron):
    Code:
    kcron: cannot connect to X server
    It seems a bit worse when I try running OpenOffice Wrter with sudo, as X just freezes with no response. I have to ctr+alt+bckspc to get out of it

    How can I fix this? I'd really like to because, atleast with kcron, I have to log into X as root to set up a cron task from within it and I'd rather not waste my time doing this (or potentially mess something up by running X as root).

    Thanks in advance!

  2. #2
    Linux Guru Vergil83's Avatar
    Join Date
    Mar 2004
    Posts
    2,407
    try
    Code:
    su -c program_name
    or with sudo
    Brilliant Mediocrity - Making Failure Look Good

  3. #3
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    Odessa, FL
    Posts
    586
    Quote Originally Posted by Vergil83
    try
    Code:
    su -c program_name
    or with sudo
    same idea

    Code:
    user@comp ~ $ sudo kcron
    Password:
    kcron: cannot connect to X server
    user@comp ~ $
    user@comp ~ $ su -c kcron
    Password:
    /bin/bash: kcron: command not found
    hmm...another problem maybe? i've noticed this with a couple of things...where my normal user could open a program from the terminal (without getting full permissions to do whatever), but root might not even recognize it as a command. even when i do...
    Code:
    user@comp ~ $ su
    Password:
    comp user #
    then run the command...i get the same thing as when i try "su -c kcron"

    what might be wrong?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Vergil83's Avatar
    Join Date
    Mar 2004
    Posts
    2,407
    very odd......

    I don't have kcron, so I can't test that program, but it worked with me and openoffice....

    try using
    Code:
    kdesu -c program_name
    for kde programs
    http://docs.kde.org/development/en/kdebase/kdesu/
    Brilliant Mediocrity - Making Failure Look Good

  6. #5
    Linux Enthusiast
    Join Date
    Jun 2005
    Location
    Odessa, FL
    Posts
    586
    Quote Originally Posted by Vergil83
    very odd......

    I don't have kcron, so I can't test that program, but it worked with me and openoffice....

    try using
    Code:
    kdesu -c program_name
    for kde programs
    http://docs.kde.org/development/en/kdebase/kdesu/
    yay!

    that was perfect....works great now!

    thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •