Fabric get( ) 权限被拒绝 use_sudo=True
Fabric get( ) permission denied with use_sudo=True
拥有fabric功能:
def get_test():
get("/home/wagans/test.txt", "/wagans/test.txt", use_sudo=True)
我遇到 'Permission denied' 错误。
完整错误:
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
我以特定用户身份连接,但尝试以根用户身份连接,但仍然收到相同的结果。
"ls -l" 在 remote_path 上的输出是:
-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,在 virtualenv 中使用 fabric 运行。
任何人都可以帮助指导我找到解决方案吗?
非常感谢。
您肯定想在从您的简单用户权限启动的脚本中使用 sudo 的权限。因此,您必须使用 sudo 命令启动脚本。
我遇到了一个非常相似的错误并找到了解决方案:
"yourfile.py" [New File]
Fatal error: get() encountered an exception while
downloading '/home/youruser/foobar'
Underlying exception:
Operation not supported
Aborting.
解决方案是不要将文件存储在权限受限的我的主目录中,您必须在权限开放的目录中存储和检索文件,例如 /tmp
这是有效的代码:
from fabric.operations import get
def fabric_ssh(ip_address, user, password, key_path, verbose=True):
return settings(
host_string=ip_address,
user=user,
key_filename=key_path,
parallel=False,
warn_only=False)
with fabric_ssh("10.0.0.3", "your_user",
"Yourpassword",
"yourkeypath",
True):
get("foobar","/tmp/")
最后它在下载后打印成功信息:
[10.130.28.191] download: /tmp/foobar <- /home/youruser/foobar
拥有fabric功能:
def get_test():
get("/home/wagans/test.txt", "/wagans/test.txt", use_sudo=True)
我遇到 'Permission denied' 错误。
完整错误:
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
我以特定用户身份连接,但尝试以根用户身份连接,但仍然收到相同的结果。
"ls -l" 在 remote_path 上的输出是:
-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,在 virtualenv 中使用 fabric 运行。
任何人都可以帮助指导我找到解决方案吗? 非常感谢。
您肯定想在从您的简单用户权限启动的脚本中使用 sudo 的权限。因此,您必须使用 sudo 命令启动脚本。
我遇到了一个非常相似的错误并找到了解决方案:
"yourfile.py" [New File]
Fatal error: get() encountered an exception while
downloading '/home/youruser/foobar'
Underlying exception:
Operation not supported
Aborting.
解决方案是不要将文件存储在权限受限的我的主目录中,您必须在权限开放的目录中存储和检索文件,例如 /tmp
这是有效的代码:
from fabric.operations import get
def fabric_ssh(ip_address, user, password, key_path, verbose=True):
return settings(
host_string=ip_address,
user=user,
key_filename=key_path,
parallel=False,
warn_only=False)
with fabric_ssh("10.0.0.3", "your_user",
"Yourpassword",
"yourkeypath",
True):
get("foobar","/tmp/")
最后它在下载后打印成功信息:
[10.130.28.191] download: /tmp/foobar <- /home/youruser/foobar