当前位置:网站首页>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
边栏推荐
- Reasonably configure thread pool
- 基于微信电子书阅读小程序毕业设计毕设作品(1)开发概要
- system()
- Detailed explanation of yolox network structure
- Negative remainder problem
- 94. 解析网页中的内容
- RT thread simulator builds lvgl development and debugging environment
- Wincc7.5 SP1 method for adjusting picture size to display resolution
- review.js ppt数学公式无法显示
- Report on the development status of China's asset appraisal industry and suggestions for future strategic planning 2022-2027
猜你喜欢

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

New product launch

Shell 数组和函数

5g R17 standard is frozen. What does it say?
![[generation confrontation network learning III] reading notes of Bigan paper and its principle understanding](/img/6b/0f0815e20cdf6da28793562bcaede1.png)
[generation confrontation network learning III] reading notes of Bigan paper and its principle understanding

Reading small program based on wechat e-book graduation design (4) opening report

Dacom G150双模耳机,为爱发声,呵护孩子听力健康成长

Demand and business model innovation - demand 4- overview of demand acquisition

Storage system overview

基于微信电子书阅读小程序毕业设计毕设作品(2)小程序功能
随机推荐
Promise to solve hell function calls can be used infinitely
负数取余问题
模塊八作業
3D object detection
5G R17标准冻结,主要讲了些啥?
基于微信电子书阅读小程序毕业设计毕设作品(3)后台功能
硬件测试之—纹波测试为什么不要使用接地夹子
leetcodeSQL:578. Questions with the highest response rate
[SQL] MySQL query statement execution sequence analysis
easycode一键生成插件自定义模板
Shell 数组和函数
exec函数、shell的实现
Global and Chinese smart government industry market research and investment risk outlook report 2022-2028
How does Eldon's ring of the law get lune quickly? Introduction to the fastest and safest method for obtaining lune
Reading applet based on wechat e-book graduation design (2) applet function
Attack and defense world (WEB) -- supersqli
Demand and business model innovation - demand 1 - Introduction to demand engineering
IO流基础知识详解--文件及IO流原理
5g R17 standard is frozen. What does it say?
What did 3GPP ran do in the first F2F meeting?