102-500 Exam QuestionsBrowse all questions from this exam

102-500 Exam - Question 26


Which of the following steps prevents a user from obtaining an interactive login session?

Show Answer
Correct Answer: B

To prevent a user from obtaining an interactive login session, one effective method is to change the user's login shell to a shell that does not allow login. The command `chsh -s /bin/false` sets the user's shell to `/bin/false`, which does not provide an interactive session, effectively preventing the user from logging in interactively. This method is specifically designed to stop logins and is commonly used for this purpose. The other options do not directly prevent interactive login sessions in the same direct and effective manner.

Discussion

9 comments
Sign in to comment
bogvtOption: B
Feb 20, 2020

it is chsh -s /bin/false username

Jodelo
Jul 5, 2021

Correct

3glagOption: E
Mar 28, 2020

correct answer is E nologin file

katieK
Jun 6, 2020

yes, but in the /etc directory, not in the /home. so correct answer is chsh -s /bin/false

georgerobelOption: B
Feb 26, 2021

chsh -s /bin/false username

ledlongOption: B
Sep 30, 2021

if we use nologin, it should be place in /etc folder and it will reject all users except root from logging in the system. But the question asks for "a user" not for all users, so we can change the path of bash shell in /etc/passwd file to /bin/false by using the command: chsh -s /bin/false username

Roger95Option: B
Nov 20, 2021

chsh -s /bin/false user1 chsh -s /sbin/nologin => same behaviour, but differrent. false -> reject to execute nologin -> pam check and reject to login, then execute the message as below examples. ================================== [root@rhel8-02 ~]# grep user1 /etc/passwd user1:x:1001:1001::/home/user1:/sbin/nologin [root@rhel8-02 ~]# su user1 This account is currently not available. [root@rhel8-02 ~]# [root@rhel8-02 ~]# chsh -s /bin/false user1 Changing shell for user1. chsh: Warning: "/bin/false" is not listed in /etc/shells. Shell changed. [root@rhel8-02 ~]# grep user1 /etc/passwd user1:x:1001:1001::/home/user1:/bin/false [root@rhel8-02 ~]# su user1 [root@rhel8-02 ~]#

EnemyTurret
Jan 1, 2021

its supposed to be /usr/sbin/nologin

lucaverceOption: B
May 25, 2022

B is correct, but there must be a bad typo in that ""s Running the command chsh -s /bin/false with the user name.

rjlg2centos8Option: B
Nov 16, 2020

"chsh -s /bin/false" is not correct, because chsh only cans change to a shell that is in the /etc/shells file, and /bin/false is not in this file, so if you execute this command you probably will get an error

Negator
Jun 8, 2021

from the NOTE section of the chsh man page ... "The only restriction placed on the login shell is that the command name must be listed in /etc/shells, unless the invoker is the superuser, and then any value may be added." So if the invoker is superuser or sudo is used this works. I have tried this with sudo and it works as intended.

rjlg2centos8
Nov 16, 2020

but supposing that the shell is in this file, the option is correct