Root用户/须藤相当于在Cygwin的? [英] Root user/sudo equivalent in Cygwin?
问题描述
我试图运行Cygwin的bash脚本。
I'm trying to run a bash script in Cygwin.
我得到必须以root身份运行,即须藤./scriptname
错误。
搭配chmod 777脚本名称
没有帮助。
我已经看了各种方法来模仿在Cygwin须藤,添加root用户,因为呼叫苏呈现误差苏:用户根本不存在
,有用的东西,并没有发现什么。
I've looked for ways to imitate sudo on Cygwin, to add a root user, since calling "su" renders the error su: user root does not exist
, anything useful, and have found nothing.
任何人有什么建议吗?
推荐答案
我回答了这个问题上超级用户但只有在在OP忽略无益的答案是当时唯一的问题的答案。
I answered this question on SuperUser but only after the OP disregarded the unhelpful answer that was at the time the only answer to the question.
这里是提升在Cygwin中的权限,从我自己的答案上的超级用户复制的正确方法:
我发现 cygwin的邮件列表。要运行命令
使用提升的权限在Cygwin中,precede与 cygstart --action =运行方式
这样的命令
I found the answer on the cygwin mailing list. To run command
with elevated privileges in Cygwin, precede the command with cygstart --action=runas
like this:
$ cygstart --action=runas command
这将打开一个Windows对话框要求输入管理员密码,如果输入正确的密码运行的命令。
这是很容易的脚本,只要〜/斌
是在你的路径。创建一个文件〜/斌/须藤
包含以下内容:
This is easily scripted, so long as ~/bin
is in your path. Create a file ~/bin/sudo
with the following content:
#!/usr/bin/bash
cygstart --action=runas "$@"
现在使文件的可执行文件:
Now make the file executable:
$ chmod +x ~/bin/sudo
现在您可以运行命令真正提升权限
$ sudo elevatedCommand
您可能需要添加〜/斌
到您的路径。您可以运行在Cygwin CLI下面的命令,或将其添加到〜/ .bashrc中
:
You may need to add ~/bin
to your path. You can run the following command on the Cygwin CLI, or add it to ~/.bashrc
:
$ PATH=$HOME/bin:$PATH
在测试了64位的Windows 8。
Tested on 64-bit Windows 8.
这篇关于Root用户/须藤相当于在Cygwin的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!