• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • How to give normal user root privileges using sudo in Linux/Unix

    In this post I will be very brief on the topic we need to do. As for more knowledge on sudo command and sudoers file follow the below link
    Understanding syntax, arguments, aliases used in sudoers file with examples (visudo)

    As per my knowledge there are two methods to do the same. I have tested these commands and methods in Red Hat Linux.

    Method 1
    # visudo
    Add an extra line in the last and make this entry
    deepak    ALL=(ALL)   ALL


    Using this above line you are telling your Linux box to give full permission for user deepak on all the hosts and all the commands
    [deepak@test ~]$ sudo /etc/init.d/network restart
    [sudo] password for test:
    Shutting down interface eth0:  Device state: 3 (disconnected)
                                                               
    [  OK  ]
    Shutting down loopback interface:                          [  OK  ]
    Bringing up loopback interface:                            [  OK  ]
    Bringing up interface eth0:  Active connection state: activated
    Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1
                                                               [  OK  ]


    Method 2
    Add the user to wheel group





    # usermod -G wheel deepak
    Verify the same
    # cat /etc/group | grep wheel
    wheel:x:10:root,
    deepak

    Now uncomment this line from sudoers file
    # visudo
    ## Allows people in group wheel to run all commands
     
    %wheel ALL=(ALL)       ALL

    The reason we did this because be default root is a member of wheel group so in case you want to give root level permission to any normal user then add him/her in wheel group.
    $ sudo /etc/init.d/vsftpd restart
    Shutting down vsftpd:                                      
    [  OK  ]
    Starting vsftpd for vsftpd:                                [  OK  ]


    Please let me know your success and failures.


    Deepak Prasad

    is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+

    Do you also have something to share here?

    Become an author and be a part of our GoLinuxHub Team, Click here for more information
    How to give normal user root privileges using sudo in Linux/Unix How to give normal user root privileges using sudo in Linux/Unix Reviewed by Deepak Prasad on Friday, January 10, 2014 Rating: 5

    9 comments:

    1. thanks for nice tutorial , can you explain , why you restarted network service and ftp service ?

      ReplyDelete
    2. It shows that file or directory not found.I guess the user is not added to wheel.

      ReplyDelete
    3. It shows that file or directory not found.I guess the user is not added to wheel.

      ReplyDelete
    4. I checked sudo config file. One admin name user not in any sudo group. But he's able to do sudo commands

      ReplyDelete
      Replies
      1. He must be having access via some public group
        To debug you can take a backup and clear your sudoers fileand then re-try
        if a user is part of wheel group then also they will get sudo access as by default wheel group is given sudoers permission

        Delete

    Powered by Blogger.