首页 > 免root版 > gg修改器是否root权限
gg修改器是否root权限
  • gg修改器是否root权限

  • 大小:15.49MB日期:2024-4-26 13:54:40
  • 语言:简体中文系统:Android
无病毒 免积分 免充值

工具详情

各位游戏大佬大家好,今天小编为大家分享关于gg修改器是否root权限的内容,轻松修改游戏数据,赶快来一起来看看吧。

提醒:本文为合集文章,后续会持续更新!

关注我,持续学习shell脚本,每日提升!

这里有个简单的需求,需要用shell脚本实现:

这个需求并不算难,同样核心命令也是find,关键点在于如何判断。也许你想find出来之后直接修改权限或者修改所有者和所属组,但这是不符合要求的,因为你没有加判断。

先来看find的一个用法:

find /dir -type f -perm 644

这样可以找到权限为644的文件,但需求中要求的是不为644的,那该怎么做呢?

这样做即可:

find /dir -type f ! -perm 644

也就是加一个! 就达到目的了,也可以这样:

find /dir -type f -not -perm 644

同理,目录权限不是755,可以这样找:

find /dir -type d -not -perm 755

find也可以找所属组和所有者:

find /dir -group root
find /dir -user root

除了使用find外,我们也可以使用stat命令来获取文件或者目录的权限、属主、属组,stat这样用:

查看文件权限:stat -c %a 1.txt
查看文件所属组:stat -c %G 1.txt
查看文件所有者:stat -c %U 1.txt

获取到权限后,再去做比对

p=`stat -c %a 1.txt`
if [ $p != ’644’ ]
then
chmod 644 1.txt
fi

最终脚本如下:

#!/bin/bash
cd /data/wwwroot/app
for f in `find .`
do
f_p=`stat -c %a $f`
f_u=`stat -c %U $f`
f_g=`stat -c %G $f`
if [ -d $f ]
then
[ $f_p != ’755’ ] && chmod 755 $f
else
[ $f_p != ’644’ ] && chmod 644 $f
fi
[ $f_u != ’www’ ] && chown www $f
[ $f_g != ’root’ ] && chown :root $f
done

或者:

#!/bin/bash
find /data/wwwroot/app/ -type d ! -prem 755 -exec chmod 755 {} ;
find /data/wwwroot/app/ ! -type d ! -prem 644 -exec chmod 644 {} ;
find /data/wwwroot/app/ ! -user www -exec chown www {} ;
find /data/wwwroot/app/ ! -group root -exec chgrp root {} ;

以上就是关于gg修改器是否root权限的全部内容,游戏大佬们学会了吗?

技能推荐

热门下载

其他人还在搜