Super User Works SUDO



Sudo is super user  a concept which is used to specify a customized  privilege commands to non-privileged  users.
All sudo configuration is located under /etc/sudoers file.

      To edit sudo configuration file use visudo command.

            Add users using useradd command

                       
                        #useradd   sree        

                        #useradd   sinu

                        #useradd   srini12

                        #useradd   srin

                        #useradd   srini

           -Assign the passwords using passwd command.

           -Open sudo configuration.

                        #visudo  -f  /etc/sudoers

       In any where type (Root access to srinui)

srinu     All   = (All)   All

where
            srini   = Name of user to be allowed to use sudo

           All =  Allow sudo access from any terminal (any Machine)

     (All) = Allow sudo command to be executed as any user.

             ALL = Allow all commands to be executed.

--> Sudo access to a group (group name is “admins”)

             %admins   All   = (All)   ALL

   ###always group should be have % symbol###

      Where  admins-> name of group to be allowed to use sudo.

    All --> Allow sudo access from any Machine
  (All)-> Allow sudo command to be executed as any user.
                       
      ALL -> Allow all commands to be executed
 Ex-
    
      user level:
 #visudo  -f  /etc/sudoers
 srni1  All = /usr/sbin/useradd, /usr/sbin/userdel
 :wq (save & quit)

      see it
               # su - jradmin1

              $ sudo /usr/sbin/useradd Mahesh1
  full path of command 
       To check the user
                       
     # vim  /etc/passwd

           Then delete the user

    $ sudo /usr/sbin/userdel  -r  srini1

    Ex-       
     Grouplevel

                #groupadd  admins

                 #useradd  -g admins  jradmin5
             
                #useradd  -g admins  jradmins6
                  
                 #visudo  -f  /etc/sudoers

                Write any where in this configuration file

                  % admins  ALL = /user/sbin/usermod

                  : wq 


        saw it

                        #su - weaps

      $sudo /usr/sbin/usermod  -g  admins  weaps

            modify user weaps group to admins.


       In sudo configuration Aliases are here

                         user alias              
                         command alias

                #visudo -f /etc/sudoers

                 Then write any where

       user _alias  webapps     =  srini, srinu

     cmnd-alias USERADMIN  = /usr/sbin/useradd, /usr/sbin/userdel

            webapps        ALL            = USERADMIN
                       
                        : wq 


                        #su - webapps

                    $sudo   /usr/sbin/useradd   srinu
                          check it once below here
                        Ex-

                        $ tail -5  /etc/passwd

Comments