Of the ways listed, which is the best way to temporarily suspend a single user’s ability to interactively login?
Of the ways listed, which is the best way to temporarily suspend a single user’s ability to interactively login?
A . Add the user name to /etc/nologin.
B . Change the user’s password.
C . Change the user name in /etc/passwd.
D . Use change to expire the user account.
E . Place the command logout in the user’s profile.
Answer: D
Explanation:
The best way to temporarily suspend a single user’s ability to interactively login is to use the chage command to expire the user account. The chage command can modify the expiration date of a user account, which is stored in the /etc/shadow file. By setting the expiration date to a past date, the user account will be locked and the user will not be able to login. This method is temporary because the expiration date can be changed again to a future date or removed to unlock the user account. For example, to expire the user account linuxconfig, we can use the following command: # chage -E 0 linuxconfig
This will set the expiration date to January 1, 1970, which is the epoch date.
To check the expiration date of a user account, we can use the -l option:
To remove the expiration date of a user account, we can use the -E option with an empty argument:
# chage -E "" linuxconfig
The other options are either invalid or not recommended. Adding the user name to /etc/nologin will not work, because /etc/nologin is a file that contains a message to be displayed to users who try to login when the system is down for maintenance. Changing the user’s password is not a good idea, because it will affect the user’s authentication and may cause security issues. Changing the user name in /etc/passwd will also affect the user’s authentication and may cause inconsistencies with other files and services. Placing the command logout in the user’s profile will not prevent the user from logging in, but only log them out immediately after login, which is not very elegant or secure.
Reference: 1: How to disable user login with Linux nologin – LinuxConfig.org 2: Disable a user’s login without disabling the account – Unix & Linux Stack Exchange 3: How to Block or Disable Normal User Logins in Linux? – GeeksforGeeks 4: How to Disable User Logins on Linux | Baeldung on Linux 5: How to Disable a User in Linux – Linux Nightly 6: How to deactivate or disable a user account in Ubuntu 20.04 LTS – Vitux 7: chage(1) – Linux manual page
Latest 102-500 Dumps Valid Version with 194 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund