Fabric get()权限被拒绝,使用\u sudo=Tru

2024-10-01 13:32:24 发布

您现在位置:Python中文网/ 问答频道 /正文

具有织物功能:

def get_test():
    get("/home/wagans/test.txt", "/wagans/test.txt", use_sudo=True)

我收到一个“权限被拒绝”错误。在

完全错误:

^{pr2}$

我以特定用户身份连接,但尝试以root用户身份连接,结果仍然相同。在

“ls-l”在远程路径上的输出为:

-rwxrwxrwx  1 root  www-data   10 May  4 13:21 test.txt

本地路径文件夹的输出是:

drwxr-xr-x   9 user     306  3 May 17:56 wagans

远程机器是ubuntu14.04,本地机器是OSX,fabric运行在virtualenv中。在

有谁能帮我找到解决办法吗? 非常感谢。在


Tags: 用户test路径功能txt机器get远程
2条回答

当然,您试图在从您的简单用户权限启动的脚本中使用sudo的权限。因此,必须使用sudo命令启动脚本。在

我得到了一个非常相似的错误,并找到了解决方法:

"yourfile.py" [New File]
Fatal error: get() encountered an exception while 
downloading '/home/youruser/foobar'

Underlying exception:
    Operation not supported

Aborting.

解决方案是不将文件存储在我的主目录中,该目录具有受限制的权限,您必须在打开的权限目录(如/tmp)中存储和检索文件

以下是有效的代码:

^{pr2}$

最后在下线后打印成功消息:

[10.130.28.191] download: /tmp/foobar <- /home/youruser/foobar

相关问题 更多 >