5. run Sudo sudo has been configured to allow it to give the user bob to super user privileges to perform the ifconfig, kill and ls command.
When bob to run these commands, you must type sudo command, and enter its password. ⒈ first login as user bob. ⒉ find bob can serve as a root user executed command, to do this, type the following command: sudo-l ⒊ if first user bob run sudo, will give a warning: WetrustyouhavereceivedtheusuallecturefromthelocalSystemAdministrator.Itusuallyboilsdowntothesethreethings: # 1) Respecttheprivacyofoters. # 2) Thinkbeforeyoutype # 3) W I t h g r e a t r e p o w c o m e g r e a s t r e s p o n s I b I l I t y ⒋ prompted for a password, note, do not enter the password for the root user, but bob's password. Password: ⒌ lists allow bob to run on the host of each command, as follows: Userbobmayrunthefollowingcommandsonthishost: (root)/bin/lill/sbin/ifconig (root) (root)/b I n/l s ⒍ run sudo ifconfig to test our configuration. If you do sudo, this option requires root privileges. Command as follows:/sbin/ifconfigeth0down this command is not valid because bob had no right to deactivate the system device. ⒎ in order to deactivate the connected device, bob must use sudo, the command looks like this: sudo/sbin/ifconfigeth0down will succeed this time. Please note that if bob's ticket has expired (the default is valid for five minutes), sudo will be asked to enter the password for bob. If the ticket is valid within the run this command, the system will not prompt us to type the password. ⒏ used the following command to reactivate the connected devices: s u d I o/n/s b I c o f f I n g e t h 0 u p ⒐ then, use the kill command to restart the httpd process, specifically as follows: psaux | g r e p h t t p d ⒑ from the displayed list, select a ApachePID; if you do not have to install Apache, you can also choose to start other services process. Command: kill-HUP [PIDNUMBER] ⒒ it won't let you restart httpd process, because you are not the root user. Therefore, you receive the following message: bash: kill: (PIDNUMBER) – N o t o w n e r ⒓ now, we instead use sudo as root to run this command, specifically as follows: sudokill-HUP (PIDNUMBER) this time successfully. ⒔ Next, we take the user bob's identity using the ls command to display the root directory. Command: ls/root result we were refused because we are not the root user. ⒕ OK, now we use sudo as root user to execute this command, see how to: sudols/root see, our request is executed. Root directory already listed. ⒖ for bob's timestamp expired, you can use sudo-k command to achieve this. In this way, bob next use sudo if you must enter the password again.
No comments:
Post a Comment