当前位置:网站首页>User and group permissions
User and group permissions
2022-06-12 19:39:00 【Lee Neo】

u+s How is it realized ?
When a user changes his password , Need modification shadow file , This file is inaccessible to ordinary users ; Why ordinary users can change their passwords ?

This is because passwd Document has u+s jurisdiction ; When executed passwd Command will be switched to root identity ;

shell Implementation process of permission ;

sudo The implementation of the program :mysu.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main(int argc, char **argv)
{
pid_t pid;
if(argc < 3)
{
fprintf(stderr, "Usage: %s <command> <file>\n", argv[0]);
exit(1);
}
pid = fork();
if(pid < 0)
{
perror("fork()");
exit(1);
}
if(pid == 0)
{
setuid(atoi(argv[1]));
execvp(argv[2], argv+2);
perror("execvp()");
exit(1);
}
wait(NULL);
exit(0);
}
Execution requires :
chown root mysu
chmod u+s mysu
./mysu 0 cat /etc/shadow // With 0 Execute as user No
边栏推荐
- 在 Traefik Proxy 2.5 中使用/开发私有插件(Traefik 官方博客)
- "As a service", the future has come, starting from the present | new mode of it consumption, FOD billing on demand
- In 2021, the global revenue of chlorinated polyvinyl chloride (CPVC) was about $1809.9 million, and it is expected to reach $3691.5 million in 2028
- What is data driven
- Demand and business model analysis -6- five topics
- synchronized下的 i+=2 和 i++ i++执行结果居然不一样
- 94. 解析网页中的内容
- leetcodeSQL:578. Questions with the highest response rate
- leetcodeSQL:602. Friend application II: who has the most friends
- BigTable (II): how BigTable achieves scalability and high performance
猜你喜欢

Fault analysis | a case of MySQL remote slave database replication delay

基于微信电子书阅读小程序毕业设计毕设作品(6)开题答辩PPT

Shell 编程正则表达式及元字符

vc hacon 联合编程 GenImage3Extern WriteImage

Leetcodesql: count the number of students in each major

New product launch

mysql的增删改查,mysql常用命令

Hardware test - why not use grounding clip for ripple test

负数取余问题

PostgreSQL数据库复制——后台一等公民进程WalReceiver pg_stat_wal_receiver视图
随机推荐
RT thread simulator builds lvgl development and debugging environment
META-INF、WEB-INF分别是什么?
设备管理-借还模块1
system()
选电子工程被劝退,真的没前景了?
Jenkins各配置选项介绍原创
asp. Net using JSON to interact with API data
Add, delete, modify and query mysql, common MySQL commands
Negative remainder problem
What are meta-inf and WEB-INF respectively?
设备管理-借还模块界面代码
基于微信电子书阅读小程序毕业设计毕设作品(8)毕业设计论文模板
【观察】华为下一代数据中心,为广西低碳高质量发展“添动能”
BannerViewPager
Reading small programs based on wechat e-book graduation design works (7) Interim inspection report
5G R17标准冻结,主要讲了些啥?
Detailed explanation of IO flow basic knowledge -- file and IO flow principle
Wangxuegang room+paging3
ThansmittableThreadLocal详解
ISCC2022