Differences

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

Link to this comparison view

Last revisionBoth sides next revision
ubuntu1604:5:4:2 [2017/05/04 13:07] – created Piotr Kłoczewskiubuntu1604:5:4:2 [2017/05/04 13:10] – [Remediation] Piotr Kłoczewski
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>
  • ubuntu1604/5/4/2.txt
  • Last modified: 2017/05/04 13:15
  • by Piotr Kłoczewski