您的位置:首页 > 产品设计 > UI/UE

suid位,sgid位及setuid(),setgid()函数实测情况

2015-06-24 13:21 381 查看
suid 标识位,可执行程序文件以所有者的身份被执行

1039进程sh

root@generic:/system/bin # cat /proc/1039/status

cat /proc/1039/status

Name: sh

State: S (sleeping)

Tgid: 1039

Pid: 1039

PPid: 1033

TracerPid: 0

Uid: 2000 2000 2000 2000

Gid: 2000 2000 2000 2000


755情况

root@generic:/system/bin # ls -all | grep test_while

ls -all | grep test_while

-rwxr-xr-x root root 109420 2015-06-23 22:37 test_while

root@generic:/system/bin # ps | grep test_while

ps | grep test_while

shell 1042 1039 272 68 00000000 0000823c R ./test_while

root@generic:/system/bin # cat /proc/1042/status

cat /proc/1042/status

Name: test_while

State: R (running)

Tgid: 1042

Pid: 1042

PPid: 1039

TracerPid: 0

Uid: 2000 2000 2000 2000

Gid: 2000 2000 2000 2000


4755情况

root@generic:/system/bin # ls -all | grep test_while

ls -all | grep test_while

-rwsr-xr-x root root 109420 2015-06-23 22:37 test_while

root@generic:/system/bin # ps | grep test_while

ps | grep test_while

root 1073 1039 272 68 00000000 0000823c R ./test_while

root@generic:/system/bin # cat /proc/1073/status

cat /proc/1073/status

Name: test_while

State: R (running)

Tgid: 1073

Pid: 1073

PPid: 1039

TracerPid: 0

Uid: 2000 0 0 0

Gid: 2000 2000 2000 2000


6755情况

root@generic:/system/bin # ls -all | grep test_while

ls -all | grep test_while

-rwsr-sr-x root root 109420 2015-06-23 22:37 test_while

root@generic:/system/bin # ps | grep test_while

ps | grep test_while

root 1085 1039 272 68 00000000 0000823c R ./test_while

root@generic:/system/bin # cat /proc/1085/status

cat /proc/1085/status

Name: test_while

State: R (running)

Tgid: 1085

Pid: 1085

PPid: 1039

TracerPid: 0

Uid: 2000 0 0 0

Gid: 2000 0 0 0


调用setuid(0)情况

root@generic:/system/bin # cat /proc/1229/status

cat /proc/1229/status

Name: test_while_setuid

State: R (running)

Tgid: 1229

Pid: 1229

PPid: 1039

TracerPid: 0

Uid: 0 0 0 0

Gid: 2000 0 0 0


调用setuid(0),setgid(0) 情况

root@generic:/system/bin # cat /proc/1260/status

cat /proc/1260/status

Name: test_while_setu

State: R (running)

Tgid: 1260

Pid: 1260

PPid: 1039

TracerPid: 0

Uid: 0 0 0 0

Gid: 0 0 0 0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: