如何给正在运行的进程sudo权限 [英] how to give running process sudo permissions

查看:64
本文介绍了如何给正在运行的进程sudo权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想给一个正在运行的进程sudo权限.就像我正常打开日食一样.现在,当我在 eclipse 上启动我的服务器时,它需要 sudo 权限,但为此我必须关闭 eclipse,然后使用 sudo eclipse 打开它以获得 sudo 权限.我尝试设置/usr/bin/eclipse 的 setuid 和 setgid 但这没有用.我不知道为什么它不起作用.

I want to give a running process sudo permissions. Like if I have opened eclipse normally. Now when I start my server on eclipse it needs sudo permission but for that I will have to close the eclipse and then open it with sudo eclipse to get sudo permission. I tried setting the setuid and setgid of /usr/bin/eclipse but that didn't worked. I don't know why it didn't worked.

推荐答案

我认为您的意思是root 权限".在称为Eclipse"的大量代码上设置 SUID 根不是一个好主意.

I think you mean "root permissions". Setting SUID root on the giant mass of code called "Eclipse" is not a good idea.

您需要的是一个 SUID 包装器,它必须是一个二进制文件.嗯,这就是sudo.但是 sudo 要求您输入密码.您需要使用 -A 开关运行它,并将 SUDO_ASKPASS 环境变量设置为类似/usr/bin/x11-ssh-askpass 的内容.然后你会看到 GUI 弹出窗口询问你的密码,然后生成的程序将以提升的权限运行.

What you need is an SUID wrapper, which has to be a binary. Hm, that's what sudo is. But sudo asks for your password. You need to run it with the -A switch , and have the SUDO_ASKPASS environment variable set to something like /usr/bin/x11-ssh-askpass. Then you will get GUI popup asking for your password, and then the spawned program will run with elevated privileges.

这与更改已运行进程的权限不同,您的问题标题暗示了这一点.这是你做不到的,AFAIK.

That is different than changing the permissions on an anlready running process, which your question title implies. That you cannot do, AFAIK.

这篇关于如何给正在运行的进程sudo权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆