Results 1 to 7 of 7

Thread: sudoers configuration for nice

  1. #1
    Join Date
    Jan 2008
    Location
    Sussex, U.K.
    Beans
    164
    Distro
    Ubuntu 12.04 Precise Pangolin

    sudoers configuration for nice

    Hi Folks,

    I'm running a game system that uses a java engine. It is running on a newly installed Hardy Herron server, 64 bit. The normal command works to start the game engine, however, I want to get it to run with a higher priority, so I put "sudo nice -n -2" in front of it.

    However, I keep getting asked for my password, and no matter how I enter the line in sudoers, I can't get it to stop.

    The line is ...

    michelle ALL=NOPASSWD: /usr/bin/nice

    I've also tried other versions like...
    michelle ALL=(ALL) NOPASSWD: /usr/bin/nice
    michelle ALL=(root) NOPASSWD: /usr/bin/nice
    ... as well as defining my user name as a variable, but I'm just not going anywhere.

    Also if I include the nice but omit the sudo and run it as root, it also works, so I'm concluding that my sudoers is going wrong somewhere.

    Any help greatly appreciated.

    Michelle.
    Last edited by msknight; August 23rd, 2008 at 10:11 PM.
    Kochanski-This is the first time I've ever been seduced by predeterminism theory.
    Kryten-Starbug was built to last sir. This old baby's crashed more times than a ZX81.
    Rimmer-Broadcast on all frequencies and all known languages, including Welsh.

  2. #2
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: sudoers configuration for nice

    Even though running the nice command with sudo in front works, it's probably not a good idea since it will also run the game engine as root, which can be dangerous. So instead of messing with sudoers, I think what you really want to do is grant yourself the privilege to "nice" a process without using sudo. You can do that by opening up:
    Code:
    gksudo gedit /etc/security/limits.conf
    And add the following line at the end:
    Code:
    <username>   -  nice   -20
    Replace <username> with your username. You'll need to either reboot or log out and log back in. Then you can run your game engine with just:
    Code:
    nice -n -2 <game engine>

  3. #3
    Join Date
    May 2008
    Beans
    46

    Re: sudoers configuration for nice

    I think you want something like
    Code:
    michelle ALL=(ALL) NOPASSWD: nice -n -2 <game engeine>

  4. #4
    Join Date
    Jan 2008
    Location
    Sussex, U.K.
    Beans
    164
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudoers configuration for nice

    Hi,

    On the first command I get, Gtk-Warning **:Cannot open display:

    This is a server version, and I usually telnet in to it. Do I have to have the X server installed and do this from the machine itself please?
    Kochanski-This is the first time I've ever been seduced by predeterminism theory.
    Kryten-Starbug was built to last sir. This old baby's crashed more times than a ZX81.
    Rimmer-Broadcast on all frequencies and all known languages, including Welsh.

  5. #5
    Join Date
    Jan 2008
    Location
    Sussex, U.K.
    Beans
    164
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudoers configuration for nice

    Gamma, didn't work. Parse error in sudoers.
    Kochanski-This is the first time I've ever been seduced by predeterminism theory.
    Kryten-Starbug was built to last sir. This old baby's crashed more times than a ZX81.
    Rimmer-Broadcast on all frequencies and all known languages, including Welsh.

  6. #6
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: sudoers configuration for nice

    Quote Originally Posted by msknight View Post
    Hi,

    On the first command I get, Gtk-Warning **:Cannot open display:

    This is a server version, and I usually telnet in to it. Do I have to have the X server installed and do this from the machine itself please?
    Do you mean you got that from running:
    Code:
    gksudo gedit /etc/security/limits.conf
    If you are telnetting into the machine then the above command won't work, since it tries to open "gedit", which is a GUI text editor. Instead, try using nano:
    Code:
    sudo nano /etc/security/limits.conf

  7. #7
    Join Date
    Jan 2008
    Location
    Sussex, U.K.
    Beans
    164
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudoers configuration for nice

    Thanks - I think that worked. The process shows as -2 in the process table.
    Kochanski-This is the first time I've ever been seduced by predeterminism theory.
    Kryten-Starbug was built to last sir. This old baby's crashed more times than a ZX81.
    Rimmer-Broadcast on all frequencies and all known languages, including Welsh.

Tags for this Thread

Bookmarks

Posting Permissions

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