What is the result of the two commands issued?

The SSHD service is controlled by the script in /etc/init.d/sshd, part of which is shown here:
[root@FAROUT ~] cat /etc/init.d/sshd
# !/bin/bash
#
# sshdStart up the OpenSSH server daemon
#
# chkconfig: 23455525
# description: SSH is a protocol for secure remite shell access. \
# This service starts up the Open SSH server daemon.
#
You issue chkconfig commands to change the sshd service:
[root@FAROUT ~] # chkconfig sshd off
[root@FAROUT ~] # chkconfig sshd reset
What is the result of the two commands issued?

The SSHD service is controlled by the script in /etc/init.d/sshd, part of which is shown here:
[root@FAROUT ~] cat /etc/init.d/sshd
# !/bin/bash
#
# sshdStart up the OpenSSH server daemon
#
# chkconfig: 23455525
# description: SSH is a protocol for secure remite shell access. \
# This service starts up the Open SSH server daemon.
#
You issue chkconfig commands to change the sshd service:
[root@FAROUT ~] # chkconfig sshd off
[root@FAROUT ~] # chkconfig sshd reset
What is the result of the two commands issued?

A.
The sshd service configuration is restored to the settings that existed before setting it off.

B.
The sshd service configuration is restored to start In run levels 2, 3, 4 and 5.

C.
The sshd service configuration is restored to start in run levels 2 and 5 only.

D.
The sshd service configuration is restored to those that existed after the operating system was
first installed.

Explanation:



Leave a Reply 5

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


vasben

vasben

The correct answer is B

The reset flag resets the on/off state for all runlevels for the service to whatever is specified in the init script in question.

[root@localhost ~]# chkconfig –list sshd
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@localhost ~]# chkconfig sshd off

[root@localhost ~]# chkconfig –list sshd
sshd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

[root@localhost ~]# chkconfig sshd reset

[root@localhost ~]# chkconfig –list sshd
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Djuro

Djuro

Yes B is correct.

Jef Adams

Jef Adams

from man page chkconfig

The reset flag resets the on/off state for all runlevels for the service to whatever is specified in the init script in question, while the resetpriorities flag resets the start/stop priorities for the service to whatever is specified in the init script.

—> D could be correct if init file was altered
—> default init sshd is on in run levels 2,3, 4 and 5 —> B

By default, the on and off options affect only runlevels 2, 3, 4, and 5, while reset and resetpriorities affects all of the runlevels. The –level option may be used to specify which runlevels are affected.

Both B and D are correct, but I would go for B

Dilliadis

Dilliadis

Correct would be
B,

Hector

Hector

As the question is: “What is the result of the two commands issued?”

The answers would be: B, D