Page 212 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 212

Network Operating Systems-I




                    notes          five-minute period without being re-prompted for a password. All commands run as sudo are
                                   logged in the log file /var/log/messages.


                                     Did u know?  How can we run the privileged command?

                                          Example: Using sudo is relatively simple as we can see from these examples.


                                   temporarily gaining root privileges
                                   In this example, user bob attempts to view the contents of the /etc/sudoers file, which is an
                                   action that normally requires privileged access. Without sudo, the command fails:

                                   [bob@bigboy bob]$ more /etc/sudoers
                                   /etc/sudoers: Permission denied
                                   [bob@bigboy bob]$
                                   Bob tries again using sudo and his regular user password and is successful:

                                   [bob@bigboy bob]$ sudo more /etc/sudoers
                                   Password:
                                   ...
                                   ...

                                   [bob@bigboy bob]$
                                   The details of configuring and installing sudo are covered in later sections.

                                   Becoming root for a complete Login session

                                   The su command allows a regular user to become the system’s root user if they know the root
                                   password. A user with sudo rights to use the su command can become root, but they only need
                                   to know their own password, not that of root as seen here.

                                   someuser@u-bigboy:~$ sudo su -
                                   Password:
                                   root@u-bigboy:~#
                                   Some systems administrators will use sudo to grant root privileges to their own personal user
                                   account without the need to provide a password.
                                   Later sections describe how to disable sudo su ability and also how to use sudo without password
                                   prompts.

                                   Downloading and installing the sudo package

                                   Fortunately the package is installed by default by RedHat/Fedora which eliminates the need to
                                   anything more in this regard.

                                   the visudo command

                                   The visudo command is a text editor that mimics the vi editor that is used to edit the /etc/
                                   sudoers configuration file. visudo uses the same commands as the vi text editor. The visudo
                                   command must run as user root and should have no arguments:

                                   [root@aqua tmp]# visudo

          206                              LoveLy professionaL university
   207   208   209   210   211   212   213   214   215   216   217