• 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.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Friday, January 10, 2014

    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
    How to give permission to user to run some commands in Linux

    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

    Follow the below links for more tutorials

    Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    How to configure Samba 4 Secondary Domain Controller
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
    15 tips to enhance security of your Linux machine
    Why is Linux more secure than windows and any other OS
    What is the difference between "su" and "su -" in Linux?
    What is swappiness and how do we change its value?
    How to log iptables messages in different log file
    What are the s and k scripts in the etc rcx.d directories
    How to check all the currently running services in Linux
    How to auto start service after reboot in Linux
    What is virtual memory, paging and swap space?

    6 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