Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revision Both sides next revision
ubuntu1604:5:4:2 [2017/05/04 11:07]
Piotr Kłoczewski created
ubuntu1604:5:4:2 [2017/05/04 11:10]
Piotr Kłoczewski [Remediation]
Line 25: Line 25:
 The following script will automatically set all user shells required to ''/​usr/​sbin/​nologin''​ and lock the ''​sync'',​ ''​shutdown'',​ and ''​halt''​ users: The following script will automatically set all user shells required to ''/​usr/​sbin/​nologin''​ and lock the ''​sync'',​ ''​shutdown'',​ and ''​halt''​ users:
 <​Code:​bash>​ <​Code:​bash>​
-#​!/​bin/​bash +#!/bin/bash  
-for user in `awk -F: '($3 < 1000) {print $1 }' /​etc/​passwd`;​ do if [ $user != "​root"​ ]; then usermod -L $user if [ $user != "​sync"​ ] && [ $user != "​shutdown"​ ] && [ $user != "​halt"​ ]; then usermod -s /​usr/​sbin/​nologin $user fi fi done +for user in `awk -F: '($3 < 1000) {print $1 }' /​etc/​passwd`;​ do  
 +if [ $user != "​root"​ ]; then 
 + usermod -L $user  
 +if [ $user != "​sync"​ ] && [ $user != "​shutdown"​ ] && [ $user != "​halt"​ ]; then 
 + usermod -s /​usr/​sbin/​nologin $user  
 +fi  
 +fi  
 +done
 </​Code>​ </​Code>​