Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2011
    Las Vegas NV

    Automatic logger prompt when using sudo su-

    I'm new to scripting and I'd like to write a script (preferably BASH) that when a user with sudo rights types "sudo <command>" he is then automatically prompted with the logger to comment why he is using sudo, and then prompted for his password. Any ideas on where to start?

  2. #2
    Just Joined!
    Join Date
    Jun 2011
    Maybe a little beside the point, but I suggest to create an alias named 'sudo' that launched the new created script and not to rename the binary 'sudo'. Because it can cause problems if you update the 'sudo' package (with yum or for a new linux release). In your script call the binary 'sudo' with its full pathname '/usr/bin/sudo'.

    Tip for your BASH script use 'readarray' or 'read' (see man read).

Posting Permissions

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