• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >linux shell > linux系统中的列出敏感用户的脚本代码

linux系统中的列出敏感用户的脚本代码

作者:mdxy-dxy 字体:[增加 减小] 来源:互联网

mdxy-dxy 通过本文主要向大家介绍了linux系统中,linux系统中git命令,linux系统中安装软件,linux 系统中打开xls,linux系统中链接分为等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

此处的敏感用户是指这个用户属于多个组,或者这个用户属于的组名跟这个用户名不一样

#! /bin/bash 
#list user who belong to more than one group 
#and list user who belong to the group which isn't the same as the username 
#w is whitelist,we will not think user in this whitelist is special or dangerous w=("root" "adm" "games" "operator" "halt" "shutdown" "sync" "daemon" "bin" "operator") function WhiteList() 
{ 
    for i in ${w[@]} 
    do
        if [ "$i" == "$1" ];then
            return 1 
        fi
    done
    return 0 
} 
IFS=" 
" for LINE in `cat /etc/passwd|awk -F: '{print $1}'` do
    WhiteList $LINE; 
    #if $? equal 1,means it is in the whitelist     if [ $? -eq 0 ];then
        a=`groups $LINE|awk -F: '{print $2}'` 
        b=`echo $a` 
        if [ "$b" != "$LINE" ];then
            #echo $LINE             echo `groups $LINE` 
        fi
    fi done
</div> </div>

您可能想查找下面的文章:

  • Linux系统中bash shell编程的10个基础问题讲解
  • linux系统中的列出敏感用户的脚本代码

相关文章

  • shell实现自动adsl拨号并检测连接状况脚本分享
  • linux shell字符串内置的常用操作(获取长度、查找、替换)
  • 使用Bash Shell检查文件是否存在的方法
  • Ubuntu、Linux Mint一键安装Chrome浏览器的Shell脚本分享
  • Shell编程 Bash引号的那点事
  • Shell中实现飞行文字效果
  • Shell中使用scp命令实现文件上传代码
  • shell脚本分析 nginx日志访问次数最多及最耗时的页面(慢查询)
  • shell 脚本安装PHP扩展的简单方法
  • 使用shell脚本分析网站日志统计PV、404、500等数据

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • linux shell 中 2>&1的含义
    • Bash脚本内置的调试方法技巧
    • Shell脚本中获取进程ID的方法
    • 分享一个入门级可控多线程shell脚本代码
    • 简单的远程FTP定时备份Shell脚本分享
    • Linux 深入理解进程权限
    • Linux进程通信(IPC)方式简介
    • UNIX sh(Bourne Shell)脚本里面使用数组的两种方法
    • Shell脚本实现查杀子进程、僵尸进程
    • Linux Shell脚本系列教程(六):数组和关联数组

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有