#!/bin/bash
# Passwd file format:
# root:x:0:0:root:/root:/bin/bash
#
# Purpose: Check if remote machines have more than one uid=0 account
#
for host in ma01 ma02
do
COUNT=`ssh $host "cat /etc/passwd | awk '{if ($3 == 0) print $0}' | wc -l "`
if [ $COUNT -gt 1 ]
then
echo "$host : More than one uid 0 account!"
fi
done
不好意思...想請問. 我這樣寫..對不對呢?
謝謝大家了.
--
# Passwd file format:
# root:x:0:0:root:/root:/bin/bash
#
# Purpose: Check if remote machines have more than one uid=0 account
#
for host in ma01 ma02
do
COUNT=`ssh $host "cat /etc/passwd | awk '{if ($3 == 0) print $0}' | wc -l "`
if [ $COUNT -gt 1 ]
then
echo "$host : More than one uid 0 account!"
fi
done
不好意思...想請問. 我這樣寫..對不對呢?
謝謝大家了.
--
All Comments