我使用布料并且有:
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/