在ps o / p中错误地显示EGID和RGID?(EGID and RGID incorrectly displayed in ps o/p?)

编程入门 行业动态 更新时间:2024-10-28 09:15:39
在ps o / p中错误地显示EGID和RGID?(EGID and RGID incorrectly displayed in ps o/p?)

我有这个:

$ ls -l test1.sh -rwxr-sr-x 1 root root 24 2011-05-31 13:27 test1.sh # sgid root $ id uid=1001(abc) gid=1001(abc) groups=4(adm),6(disk),20(dialout),21(fax),24(cdrom),26(tape),29(audio),30(dip),44(video),46(plugdev),104( fuse),106(lpadmin),112(netdev),121(admin),122(sambashare),1001(abc),1002(sbox)

但是,当我运行test1.sh时,我没有看到有效组所有者是ps o / p中的root ...为什么?

$ ps -o pid,ppid,cmd,euid,euser,ruid,ruser,egid,egroup,rgid,rgroup,nice,tty,user PID PPID CMD EUID EUSER RUID RUSER EGID EGROUP RGID RGROUP NI TT USER 8793 2349 bash 1001 abc 1001 abc 1001 abc 1001 abc 0 pts/2 abc 8865 8793 /bin/bash ./test1.sh 1001 abc 1001 abc 1001 abc 1001 abc 0 pts/2 abc 8866 8865 sleep 60 1001 abc 1001 abc 1001 abc 1001 abc 0 pts/2 abc 8868 8793 ps -o pid,ppid,cmd,euid,eus 1001 abc 1001 abc 1001 abc 1001 abc 0 pts/2 abc

I have this:

$ ls -l test1.sh -rwxr-sr-x 1 root root 24 2011-05-31 13:27 test1.sh # sgid root $ id uid=1001(abc) gid=1001(abc) groups=4(adm),6(disk),20(dialout),21(fax),24(cdrom),26(tape),29(audio),30(dip),44(video),46(plugdev),104( fuse),106(lpadmin),112(netdev),121(admin),122(sambashare),1001(abc),1002(sbox)

But, when I run test1.sh, I do not see the Effective Group Owner to be root in ps o/p.. why ?

$ ps -o pid,ppid,cmd,euid,euser,ruid,ruser,egid,egroup,rgid,rgroup,nice,tty,user PID PPID CMD EUID EUSER RUID RUSER EGID EGROUP RGID RGROUP NI TT USER 8793 2349 bash 1001 abc 1001 abc 1001 abc 1001 abc 0 pts/2 abc 8865 8793 /bin/bash ./test1.sh 1001 abc 1001 abc 1001 abc 1001 abc 0 pts/2 abc 8866 8865 sleep 60 1001 abc 1001 abc 1001 abc 1001 abc 0 pts/2 abc 8868 8793 ps -o pid,ppid,cmd,euid,eus 1001 abc 1001 abc 1001 abc 1001 abc 0 pts/2 abc

最满意答案

编写安全的shell脚本真的很难。 想想$PATH , $IFS ,......所以,Linux不尊重shell脚本的setuid / setgid位。

Writing safe shell scripts is really hard. Think about $PATH, $IFS, ... So, Linux doesn't honour the setuid/setgid bit for shell scripts.

更多推荐

本文发布于:2023-07-22 19:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1222834.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   EGID   ps   displayed   incorrectly

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!