python 织物: put() results in permission denied

标签 python fabric

我使用布料并且有:

put('/projects/configuration-management/prototype','/etc/nginx/sites-available')

结果是:

Underlying exception:
    Permission denied

Aborting.

其他配置文件可以轻松上传。我怎样才能避免我的问题?

最佳答案

看起来您需要 super 用户权限,使用 sudo 运行它,它会正常工作

在文档 ( link here ) 中说:

While the SFTP protocol (which put uses) has no direct ability to upload files to locations not owned by the connecting user, you may specify use_sudo=True to work around this. When set, this setting causes put to upload the local files to a temporary location on the remote end (defaults to remote user’s $HOME; this may be overridden via temp_dir), and then use sudo to move them to remote_path.

关于 python 织物: put() results in permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46981928/

相关文章:

python - 如何在结构中以并行模式运行一次命令?

python - 如何从 selenium python 中的可点击元素获取链接

Python:以分数形式缩小/扩展二维数组

Python 生成的 lzma 文件缺少未压缩大小

python - mongodump 然后删除 : Not exact same number of records

python - Fabric 无法检测到远程上的多个 ssh key

python - Lambda 数据框引用另一列中的值

带有换行符的 Python 打印数组

python - 用 fabric 模拟 KeyboardInterrupt

fabric - 在 python 模块中组织结构任务