如何让用户以root权限运行脚本? [英] How can I let users run a script with root permissions?

查看:911
本文介绍了如何让用户以root权限运行脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出 SUID shell脚本的危险,在Linux中,有没有更安全的方式来授予具有root权限的脚本(bash,PHP)的无密码访问?

Given the dangers of SUID shell scripts, is there a more secure way of giving passwordless access to scripts (bash, PHP) with root permissions in Linux?

(Ubuntu 8.10)

(Ubuntu 8.10)

推荐答案

您可以考虑 sudo

尽管不是'passwordless',但它并不需要为用户提供root密码.它还可以提供对脚本使用情况的审核跟踪.

Although not 'passwordless', it doesn't require the user to be given the root password. It can also provide an audit trail of use of the script.

edit:根据Chris的评论,某些选项完全不需要密码,请参见

edit: as per comment from Chris, there is an option not to require a password at all for certain commands, see here for details. It can also be set up not to prompt excessively for the password, i.e. one entry of the password can be good for multiple commands over a period of use.

顺便说一句,sudo内置于Ubuntu中,并与Gnome很好地集成在一起.当ubuntu提示您输入密码进行特权操作时,这就是幕后的sudo.

By the way, sudo is built in to Ubuntu and nicely integrated with Gnome. When ubuntu prompts you for your password to do privileged operations, that's sudo under the hood.

这篇关于如何让用户以root权限运行脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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