用fabric函数:
def get_test():
get("/home/wagans/test.txt", "/wagans/test.txt", use_sudo=True)
我收到“权限被拒绝”错误。
完整错误:
Fatal error: get() encountered an exception while downloading '/home/wagans/test.txt'
Underlying exception:
Permission denied
Aborting.
Disconnecting from root@#########... done.
get() encountered an exception while downloading '/home/wagans/test.txt'
Underlying exception:
Permission denied
我以特定用户身份连接,但尝试以根用户身份连接,但仍然收到相同的结果。
remote_path 上“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
远程机器是 Ubuntu 14.04,本地是 OSX,fabric 在 virtualenv 中运行。
任何人都可以帮助指导我找到解决方案吗? 非常感谢。
请您参考如下方法:
您肯定会尝试在从您的简单用户权限启动的脚本中使用 sudo 的权限。因此,您必须使用 sudo 命令启动脚本。
