Which two statements are true about administering the use of the Sudo command in Oracle Linux?

Which two statements are true about administering the use of the Sudo command in Oracle
Linux?

Which two statements are true about administering the use of the Sudo command in Oracle
Linux?

A.
visudo will never save the /etc/sudoers file if there are syntax errors in the file after editing.

B.
visudo prompts for an action if there are syntax errors in the /etc/sudoers file after editing.

C.
Using vi to edit /etc/sudoers opens the file read only.

D.
Multiple administrators may edit the /etc/sudoers file simultaneously using visudo but only one
may save the edited result.

E.
Multiple administrators may edit the /etc/sudoers file simultaneously using vi but only one may
save the edited result.

Explanation:
A: visudo parses the sudoers file after the edit and will not save the changes if there
is a syntax error.
E: visudo locks the sudoers file against multiple simultaneous edits
Note:
* sudo is configured through the file /etc/sudoers. Like with most Linux configuration files, any text

following a pound sign in the sudoers file is a comment. Within the sudoers file, sets of commands,
groups of users, and associate users or groups with command sets can be configured.
* If you want to grant certain users authority to be able to perform specific administrative tasks via
sudo, use the visudo command to modify the /etc/sudoers file.
The sudo command offers a way to grant partial or full access to the root account without the
users needing the root password.



Leave a Reply 14

Your email address will not be published. Required fields are marked *


vasben

vasben

A,B.C are all correct

the tuk-ITE'05 CON-KMITL

the tuk-ITE'05 CON-KMITL

A B C

Dvityuk

Dvityuk

visudo: >> /etc/sudoers: syntax error near line 9 <<<
What now?
Options are:
(e)dit sudoers file again
e(x)it without saving changes to sudoers file
(Q)ui and save changes to sudoers file (DANGER!)
What now? Q
[root@localhost ~]#

A – wrong.

Lilacmega

Lilacmega

The answer is A,E
================

*****

*****

Answer: A and D

Reason:
visudo locks the sudoers file so it cannot be edited by anyone else simultaneously. It also checks the syntax of your edits and provides basic sanity checks. If someone else is editing the file you’ll get a message to try later, and if there are errors in your edits it wont save them.

roman

roman

B,E

A – wrong.
visudo: >>> /etc/sudoers: syntax error near line 21 <<>> /etc/sudoers: syntax error near line 21 <<<
What now? ?
Options are:
(e)dit sudoers file again
e(x)it without saving changes to sudoers file
(Q)uit and save changes to sudoers file (DANGER!)

What now?

D – wrong.
visudo: /etc/sudoers busy, try again later

Marc

Marc

B [root@olite-xp openldap]# visudo
visudo: >>> /etc/sudoers: syntax error near line 118 <<<
What now?
Options are:
(e)dit sudoers file again
e(x)it without saving changes to sudoers file
(Q)uit and save changes to sudoers file (DANGER!)

What now? x

C (E45: 'readonly' option is set (add ! to override))

Jef Adams

Jef Adams

DESCRIPTION
visudo edits the sudoers file in a safe fashion, analogous to vipw(8). visudo locks the
sudoers file against multiple simultaneous edits, provides basic sanity checks, and checks
for parse errors. If the sudoers file is currently being edited you will receive a message
to try again later. —> not D

visudo parses the sudoers file after the edit and will not save the changes if there is a
syntax error. Upon finding an error, visudo will print a message stating the line num‐
ber(s) where the error occurred and the user will receive the “What now?” prompt. At this
point the user may enter ‘e’ to re-edit the sudoers file, ‘x’ to exit without saving the
changes, or ‘Q’ to quit and save changes. The ‘Q’ option should be used with extreme care
because if visudo believes there to be a parse error, so will sudo and no one will be able
to sudo again until the error is fixed. If ‘e’ is typed to edit the sudoers file after a
parse error has been detected, the cursor will be placed on the line where the error
occurred (if the editor supports this feature).
–> A, unless Q is used
–> B

So I would go for B and E

deceneu

deceneu

I would go for B and C.

The vi actually opens sudo as read only but is letting you afterwards to modify it.
and as of E if they are two admins indeed you are notified that someone else modified the file inbetween but is letting you override the prior modification. Tried on OEL 6.

Dilliadis

Dilliadis

I will go with
C, – vi opens /etc/sudoers only in ro.
B, – visudo prompts for an action

Alex

Alex

A,C
A is explained.

C tested. When I try to save the file, it warns this is read-only set and use ! to override.

some.guy

some.guy

It’s B and C.

Answer “A” says “never”, but it’s not never, you can do it, you just have to choose to do it. So: not A.

Sam

Sam

A & C is the correct answers below is the Real time explanation .

A . visudo will never save the /etc/sudoers file if there are syntax errors in the file after editing.

Real time o/p :

[root@ ~]#visudo
visudo: >>> /etc/sudoers: syntax error near line 21 <<<
What now?
Options are:
(e)dit sudoers file again
e(x)it without saving changes to sudoers file
(Q)uit and save changes to sudoers file (DANGER!)

What now? e

C . Using vi to edit /etc/sudoers opens the file read only.

Real time o/p from the cmd : [root@ ~]# vim /etc/sudoers after you opened at the EOF you can see :

## Updating the locate database
# Cmnd_Alias LOCATE = /usr/bin/updatedb
"/etc/sudoers" [readonly] 118L, 4002C