English 中文(简体)
a. 不享有特权的指挥权
原标题:Run a command without privileges in a root shell
  • 时间:2012-01-14 10:39:37
  •  标签:
  • bash

我有一份带有根本特权的文字,我有的指挥权,不能与文稿规定的特权相提并论。 我需要一种在没有这些特权的情况下管理这一指挥的方法。

从我能确定的情况来看,我可以把指挥作为另一个用户,使用像Dedo这样的工具。 但是,这样做需要事先了解用户名称(或ID)。 这也引起了一个或两个安全问题。

我的问题是:不可能简单地把这一指挥作为根基,而没有更高的特权? 如果没有,是否有合适的替代办法?

最佳回答

您确实可以使用<代码>sudo,以较低特权管理指挥,如:

sudo -u USERNAME COMMAND

or better

sudo -u USERNAME -g GROUPNAME COMMAND

Note that this will require proper entries in the sudoers file.

如果您不了解用户的名称,而只想以一些低劣的特权来管理指挥,你可以为此使用用户<条码>、第<0>/代码>和组群<条码>。

问题回答
su <non-root-user> -c  some_command 

My question is: Is it possible to simply run that command as root but without the elevated privileges?

页: 1 根源在于它享有充分的特权。 事实上,任何<>账户是它所拥有的特权。 没有根基特权的经营方式是作为除根基以外的用户经营。

如果没有,是否有合适的替代办法?

见其他答复。 页: 1 非专用账户,这意味着你必须知道某些其他账户的名称(或数字UID)。

正如Adam Zalcman所建议的,noone账户可能合适。 也可读到<代码>/etc/passwd。 或相当于找到一个有效的账户(尽管有些随机实际用户可能会造成问题)。

既然你有根基的特权,你可以(通常?)create一个新账户,用于指挥。 然而,这很可能是过度的。

最简单的解决办法只是找到一种办法,具体指明一个非专用账户。





相关问题
Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Bash usage of vi or emacs

From a programming standpoint, when you set the bash shell to use vi or emacs via set -o vi or set -o emacs What is actually going on here? I ve been reading a book where it claims the bash shell ...

Dynamically building a command in bash

I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...

Perform OR on two hash outputs of sha1sum

I want perform sha1sum file1 and sha1sum file2 and perform bitwise OR operation with them using bash. Output should be printable i.e 53a23bc2e24d039 ... (160 bit) How can I do this? I know echo $(( ...

Set screen-title from shellscript

Is it possible to set the Screen Title using a shell script? I thought about something like sending the key commands ctrl+A shift-A Name enter I searched for about an hour on how to emulate ...