简体   繁体   English

如何从进程中获得root特权

[英]How to get root privileges from process

It's possible to get root privileges by simple code like this: 可以通过以下简单代码获得root特权:

char *name[2];
name[0] = "/bin/bash";
name[1] = "-p";
name[2] = 0x0;

execve(name[0], name, 0x0);

but this solution requires to set sticky bit chown root:root; 但是此解决方案需要设置粘性位chown root:root; chmod u+s. chmod u + s。

The question is how to get root privileges only by providing user name and password (by process and to this process, - so process asking user for login information and use this permission to execution). 问题是如何仅通过提供用户名和密码来获得root特权(按过程进行此过程,因此-过程要求用户提供登录信息并使用此许可权来执行)。

Issue is solved by providing a root passphrase directly to su utility. 通过直接向su实用程序提供根口令来解决问题。 It can be easily riched by using fd_set or pipes and system call forkpty that returns a ready to login shell. 通过使用fd_set或管道以及返回准备登录外壳程序的系统调用forkpty,可以轻松地丰富它。

Please check my post that describe this question and shows a solution: http://www.andreypudov.com/2013/02/user-authorization-in-linux.html 请检查我的描述该问题并显示解决方案的帖子: http : //www.andreypudov.com/2013/02/user-authorization-in-linux.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM