Skip to content

Commit b1635b0

Browse files
committed
Shows which OS accounts don't have passwords set
Works on Linux and Solaris
1 parent 55d0fac commit b1635b0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

users_no_password.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Script Name : users_no_password.sh
4+
# Author : Craig Richards
5+
# Created : 05-September-2012
6+
# Last Modified : 11-April-2013
7+
# Version : 1.1
8+
9+
# Modifications : 1.1 - 11-April-2013 - CR - Changed to do an OS check so the same script can be used on either Solaris or Linux
10+
11+
# Description : This will show all OS accounts that don't have a password set.
12+
13+
if [[ `uname -s` == 'Linux' ]]; then
14+
nopass=`passwd -Sa | grep NP | awk '{print $1}'`
15+
elif [[ `uname -s` == 'SunOS' ]]; then
16+
nopass=`passwd -sa | grep NP | awk '{print $1}'`
17+
fi
18+
19+
if [ -z "$nopass" ]
20+
then
21+
echo "Good - All user accounts have a password"
22+
else
23+
echo "Not Good - $nopass has no password set"
24+
fi
25+

0 commit comments

Comments
 (0)