/********************************************************************* * Author : Samson * Date : 07/06/2014 * Test platform: * Linux ubuntu 3.8.0-42-generic #62~precise1-Ubuntu * GNU bash, version 4.2.24(1)-release * *******************************************************************/
In system reinforcement, users who do not need to log on should be locked so that they cannot log on to shell to execute other system actions, you can use either of the following methods to configure this function:
0. Set the shell field in the/etc/passwd file to/bin/false;
1. Set the shell field in the/etc/passwd file to/usr/sbin/nologin;
The difference between the two methods is that one can log on to FTP and the other cannot log on;
The following two configurations are tested:
0-create a new user: testfalse;
0. Modify the shell item in the/etc/passwd file as root:
Testfalse: X: 1001: 1001:,:/home/testfalse:/bin/false
Run:
[Email protected]: ~ # Su testfalse
Result: No task return value;
So what are the records of auth. log:
Jul 5 12:46:10 Ubuntu su [9785]: Successful Su for testfalse by root
Jul 5 12:46:10 Ubuntu su [9785]: +/dev/pts/1 root: testfalse
Jul 5 12:46:10 Ubuntu su [9785]: pam_unix (SU: session): session opened for user t
Estfalse by v0idp0int (uid = 0)
Jul 5 12:46:10 Ubuntu su [9785]: pam_unix (SU: session): session closed for user testfalse
1. Modify the shell item in the/etc/passwd file as root:
Testfalse: X: 1001: 1001:,:/home/testfalse:/usr/sbin/nologin
Switch the user to testfalse and execute:
Su testfalse
Result:
[Email protected]: ~ $ Su testfalse
This account is currently not available.
So what are the records of auth. log:
Jul 5 13:02:31 Ubuntu su [10700]: Successful Su for testfalse by v0id
Jul 5 13:02:31 Ubuntu su [10700]: +/dev/pts/3 v0id: testfalse
Jul 5 13:02:31 Ubuntu su [10700]: pam_unix (SU: session): session opened for user testfalse by v0id (uid = 1000)
Jul 5 13:02:31 Ubuntu nologin: Attempted login by v0id on/dev/pts/3
Jul 5 13:02:31 Ubuntu su [10700]: pam_unix (SU: session): session closed for user testfalse