小编Pra*_*nay的帖子

我有多少贝壳?

问题:找出我有多少贝壳深。

详细信息:我经常从 vim 中打开外壳。构建并运行并退出。有时我忘记在里面打开另一个vim,然后打开另一个shell。:(

我想知道我有多少贝壳,甚至可能一直在我的贝壳屏幕上显示它。(我可以管理那部分)。

我的解决方案:解析进程树并查找 vim 和 bash/zsh 并找出当前进程在其中的深度。

这样的东西已经存在了吗?我找不到任何东西。

shell bash vim zsh shell-script

76
推荐指数
6
解决办法
1万
查看次数

setuid root 不起作用

目标:以 root 身份运行程序(C++ 二进制文件)。同:SetUID 位在 Ubuntu 中不起作用?

并且:为什么 setuid 对可执行文件不起作用?

./a.out 输出:

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root? psurana //output for "whoami" Look below for the code.

ls -l 输出:

-rwsrwxr-x 1 root root 46136 Jun 7 20:13 a.out

编码 :

#include <string>
#include <stdlib.h>
int main(int argc, char *argv[]){
        std::string input = "apt-get install " + std::string(argv[1]);
        system(input.c_str());
        system("whoami"); …
Run Code Online (Sandbox Code Playgroud)

linux setuid privileges

3
推荐指数
1
解决办法
2979
查看次数

标签 统计

bash ×1

linux ×1

privileges ×1

setuid ×1

shell ×1

shell-script ×1

vim ×1

zsh ×1