检查目录权限是否为root
#! /bin/bash
dir=/home/mysql
for file in `ls $dir`; do
for file2 in `ls $dir/$file` ; do
own=`ls -ld $dir/$file/$file2 |awk '{print $3}'`
if [ "$own" = "root" ] ; then
chown -R mysql:mysql $dir/$file/$file2
echo "$dir/$file/$file2" >>/tmp/checkown.log
fi
done
done
dir=/home/mysql
for file in `ls $dir`; do
for file2 in `ls $dir/$file` ; do
own=`ls -ld $dir/$file/$file2 |awk '{print $3}'`
if [ "$own" = "root" ] ; then
chown -R mysql:mysql $dir/$file/$file2
echo "$dir/$file/$file2" >>/tmp/checkown.log
fi
done
done
none