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

A. Run the command chsh -s /bin/false with the user name.
B. Set the UID for the user to 0.
C. Remove the user from the group staff.
D. Add the user to /etc/noaccess.
E. Create a .nologin file in the user's home directory.

题解

选项 A,「chsh」指令可以改变登录 shell,将用户的登录 shell 改成「/bin/false」可以让用户无法进行登录。

选项 B,将 UID 设成 0 会让用户拥有 root 权限。

选项 C,用户登录和群组并没有什么关联。

选项 D,没有「/etc/noaccess」文件。

选项 E,家目录的「.nologin」文件不会影响用户登录。