Results 1 to 5 of 5

Thread: NEED Help with Sudo

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default NEED Help with Sudo

    I have a tricky situation with sudoers.

    I have an account called oracle

    I have created a Cmnd_Alias called "BlockedCommands" and have added "/bin/su - root,/bin/su root,/bin/su, /bin/su -" to that list.

    I have granted a user access called x-men to following access
    x-men ALL=(root) NOPASSWD :/bin/su - oracle, ALL, !BlockedCommands.

    Issue i am facing is, x-men account cannot sudo su - oracle because (i think) its defined in BlockedCommands, which is then restricted for the account.

    My Question is,
    How can i prevent people from becoming root via (sudo su - root or sudo su root or sudo su or sudo su -), grant ability to issue everyother command and also allow sudo su - oracle.

    Please help!!

  2. #2
    Senior Member Rahul.Patil's Avatar
    Join Date
    Feb 2012
    Location
    Mumbai india
    Posts
    447
    Thanks
    10
    Thanked 46 Times in 43 Posts
    Rep Power
    6

    Default

    Hi,

    sudo and su both are different , you can restrict "sudo su - root" using visudo but not "su", for achieve the same you have to create pam rules , refer this link for the same
    Rahul Patil <http://www.linuxian.com>

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Thanks Rahul for you response.

    I am not looking to restrict user from issuing "su". If a user know password to an account i am OK with them using su, followed by password to gain access to the account.

    My question was more on the lines of using sudo su.

    One can gain access to root by issuing any of the following
    sudo su - root
    sudo su root
    sudo su -
    sudo su

    Due to business reasons, i have to grant a group ability to issue almost all commands as root (via sudo) but want to prevent them from gaining access to root, hence i have created that Blocked_Commands Command Alias. Now, i also want to grant explicit permission to grant a user access to a specific account (sudo su - oracle) but because of the Blocked_Command alias where sudo su - and sudo su are blocked, user is unable to execute sudo su - oracle.

    So, wanted to know how to get around this issue.

    Hope this helps understand my issue ?

    Thank You in advance for your support.

  4. #4
    Senior Member Rahul.Patil's Avatar
    Join Date
    Feb 2012
    Location
    Mumbai india
    Posts
    447
    Thanks
    10
    Thanked 46 Times in 43 Posts
    Rep Power
    6

    Default

    Hi,

    Add sudors entry as below:
    Code:
    Cmnd_Alias DENY_CMD = /bin/su
    
    x-men ALL=(root) NOPASSWD:!DENY_CMD,/bin/su - oracle
    P.S DENY_CMD must be in caps


    Testing :
    Code:
    root@svr100:~# su - x-men -c "sudo su - root"
    [sudo] password for x-men:
    Sorry, user x-men is not allowed to execute '/bin/su - root' as root on svr100.
    
    root@svr100:~# su - x-men -c "sudo su - oracle"
    $ ls
    $ ls -a
    .  ..  .bash_logout  .bashrc  .profile
    $
    Rahul Patil <http://www.linuxian.com>

  5. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Thanks Rahul.

    I see the mistake i was doing. I had granted

    x-men ALL=(root) NOPASSWD :/bin/su - oracle, ALL, !BlockedCommands.

    After taking a hint for your solution, i have modified it to following, which works file.

    x-men ALL=(root) NOPASSWD :!BlockedCommands, /bin/su - oracle, ALL

    Thank you for all your support.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SUDO Query
    By harmandeep in forum CentOS / RHEL / Fedora
    Replies: 0
    Last Post: 30th July 2011, 06:04 AM
  2. [Solved] Sudo Exclude Commands And Disable: sudo su -, Bash Shell
    By Penny in forum Networking, Firewalls and Security
    Replies: 7
    Last Post: 19th June 2010, 07:13 PM
  3. Many users can do 'sudo su', how to know who is who?
    By permalac in forum Networking, Firewalls and Security
    Replies: 2
    Last Post: 26th October 2008, 09:50 PM
  4. sudo
    By senthil6face in forum Linux software
    Replies: 2
    Last Post: 22nd August 2008, 03:25 PM
  5. sudo and apache
    By txt3rob in forum Web servers
    Replies: 1
    Last Post: 18th April 2008, 11:30 PM

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41