- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
setuid 和seteuid 函数有什么区别。在手册页中,这两个函数都有相似的描述。
设置标识符:
DESCRIPTION
setuid() sets the effective user ID of the calling process. If the effective UID of the caller is root, the real UID and saved
set-user-ID are also set.
seteuid:
DESCRIPTION
seteuid() sets the effective user ID of the calling process. Unprivileged user processes may only set the effective user ID to
the real user ID, the effective user ID or the saved set-user-ID.
在这两个描述中都包含设置调用进程的有效用户ID
。那么有什么区别这两个以及这些函数之间的功能差异。
还有一个疑问是,使用 chmod(chmod u+s ) 只有我们可以给文件设置set user id权限。然后只有在程序运行期间,进程才有权限设置谁用户身份。除了这些功能之外,这些功能如何将有效用户标识设置为进程。
最佳答案
来自man page :
Thus, a set-user-ID-root program wishing to temporarily drop root
privileges, assume the identity of an unprivileged user, and then
regain root privileges afterward cannot use setuid(). You can
accomplish this with seteuid(2).
关于c - setuid 与 seteuid 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33076543/
这其实是一个三段式的问题,下面我会解释,但是问题是: 如何使用 gdb 以 root 权限运行程序的一部分,而其余部分以正常方式运行? 为什么我使用 mkstemp 在/tmp 中创建文件时会得到“权
我不得不为某人做一个肮脏的 Linux hack,这样他们就可以在非根用户的情况下使用 cupsenable printername shell 命令启动打印机。我不希望他们能够以 root 身份使用
我编写的一个 Python 扩展需要 root 访问权限才能执行单个硬件初始化调用。我不想仅仅为了我的扩展中的这个调用而以 root 身份运行整个脚本,所以我想编写一个包装器来执行此初始化,然后再降低
我已经使用 root 运行了一个程序,在其中我为 uid 9999999 调用了 setuid 函数,然后它成功地设置了这个 uid,即使它不存在于/etc/passwd 中。那么 setuid 如何
我有一个要设置 uid 位的 shell 脚本。我将所有者设置为 root 并设置 uid 位。我在 shell 中添加了 'whoami' 以检查它是否正常工作但是当我执行脚本时,whoami 返回
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
如果我在循环中调用 setuid 以成为 root 并重置 uid,这只会工作一次。我有以下代码: #include #include #include int my_func(int i) {
我正在扩展一些在 GNU/Linux (Ubuntu 14.04) 下运行的软件(我不是作者),由一个 manager 进程和几个 worker 组成过程。管理器可以通过我可以在配置文件中指定的命令行
当我在我的程序中尝试 setuid 时,它创建了 2 个进程。一个是父进程,另一个是子进程。 int isRoot() { if (getuid() != 0) {
假设我们正在查看以下场景: 文件 saymyname.c(包括省略) int main(int argc, char** argv){ system("whoami"); } 构建并设置权
正在尝试设置 cap_setgid、cap_setuid、cap_setpcap。 #include #include int main() { cap_t caps; caps
我目前正在尝试了解文件权限中的特殊位的作用,但目前正试图了解 setuid 位的作用。从所有在线资源中,它说: Commonly noted as SUID, the special permissi
我有以下简单代码来检查我的 getuid 函数: uidActual=getuid(); printf ("User id is [%d]\n", ui
我被要求找到一个命令,该命令将仅列出从当前目录(及其下)开始的具有 setuid 位的文件。有人告诉我这是正确的方法: find /home/anyuser -type f \( -perm -400
伙计们。 这是我的问题: 我有一个可执行文件需要在系统的特定位置创建一个文件夹。 无论谁执行它,我都希望它能够这样做。 我的想法是将父文件夹(可执行文件需要在其中创建文件夹的文件夹)提供给用户,并将可
我正在尝试了解缓冲区溢出和 setuid。我使用这个来源: #include #include #include int main(void){ char prog[]="/bin/ls
我在 Linux 中工作,并尝试在 Linux 上使用 setuid 执行 C 程序。这是我的代码: #include #include #include #include int main(
需要一些关于传递 argv 的帮助,以便 shell 脚本可以作为/usr/local/bin/script.sh 用户域运行 #include #include #include #inclu
我一直在努力思考 setuid/setgid 是如何工作的……我想到了这个人为的例子: 用户: 用户A属于A组 用户B属于B组 文件 a.txt 由用户 A 拥有,权限为 rw-rw----- (66
changeIDs() is trying to use setuid() to change the effective user id but it always errors out and I
我是一名优秀的程序员,十分优秀!