Find the answer to your Linux question:
Results 1 to 6 of 6
I'd like sudo to timeout quickly, because I don't like the idea of giving normal users root access for ages. I edited my sudoers file thusly: Defaults !lecture,tty_tickets,!fqdn # User ...
  1. #1
    Just Joined!
    Join Date
    Apr 2006
    Posts
    97

    Sudo doesn't timeout

    I'd like sudo to timeout quickly, because I don't like the idea of giving normal users root access for ages. I edited my sudoers file thusly:

    Defaults !lecture,tty_tickets,!fqdn

    # User privilege specification
    root ALL=(ALL) ALL
    bforbes ALL=(ALL) ALL
    Defaults:ALL rootpw,passwd_timeout=1
    But once I use sudo, it doesn't appear to ever timeout. I can do sudo -k to forcibly time it out, but I want it to be automatic. Is that possible?

  2. #2
    Just Joined!
    Join Date
    Apr 2006
    Location
    Canada, Earth
    Posts
    16
    I don't know if there is a standard way to do this or not but your post has gone unanswerd for a few days to here is what I would do.

    sudo is going to run some program as the root user. You could add a script to the ~/.bashrc of the root account that would run first and have some timeout that would kill the bash session for that login. This would take some testing to figure out exaclty what to do. If I get some time soon I till try to do this and post my code. It sounds like a cool project.

  3. #3
    Just Joined!
    Join Date
    May 2006
    Posts
    5

    Post What?

    Sudo is for running a single command as root. When that program is closed sudo is over. Commands after that, in the same terminal, will run as a normal user.

  4. #4
    Just Joined!
    Join Date
    Apr 2006
    Location
    Canada, Earth
    Posts
    16
    AwesomeMachine: I don't know if your "What?" was directed at me or not but you are right. The issues is if the single command is xterm or some other terminal program then the user could continue to run any commands they want as root, as many times as they like.

    My solution to this is fork a process in the back ground that kills the sudo and the command after some time. The problem with that is once a user as sudo'ed to root they could kill that process and stop it from terminating their session.

    The only real solution would be to hack sudo source code and build in a time out but I have not looked at that and expect it to me more complex then a simple bash script.

  5. #5
    Linux Enthusiast
    Join Date
    Aug 2005
    Location
    Hell
    Posts
    514
    Quote Originally Posted by bforbes
    I'd like sudo to timeout quickly, because I don't like the idea of giving normal users root access for ages. I edited my sudoers file thusly:



    But once I use sudo, it doesn't appear to ever timeout. I can do sudo -k to forcibly time it out, but I want it to be automatic. Is that possible?
    I think you should set the "timestamp_timeout" flag.

    Quote Originally Posted by GodofPain
    AwesomeMachine: I don't know if your "What?" was directed at me or not but you are right. The issues is if the single command is xterm or some other terminal program then the user could continue to run any commands they want as root, as many times as they like.

    My solution to this is fork a process in the back ground that kills the sudo and the command after some time. The problem with that is once a user as sudo'ed to root they could kill that process and stop it from terminating their session.

    The only real solution would be to hack sudo source code and build in a time out but I have not looked at that and expect it to me more complex then a simple bash script.
    This is not relevant to the OP's issue. The OP wants the sudo timestamp to expire, this has nothing to do with what can be run through sudo itself.

  6. #6
    Just Joined!
    Join Date
    Apr 2006
    Posts
    97
    Quote Originally Posted by spoon!
    I think you should set the "timestamp_timeout" flag.
    Thanks that did it.

Posting Permissions

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