当我运行fabric.py来部署我的站点时Ubuntu。Fabric执行时拒绝权限rm -rf
我遇到了错误:
[192.168.15.143] run: rm -rf /home/user/project/weather_station/
[192.168.15.143] out: rm: cannot remove '/home/user/project/weather_station/logs/gunicorn.log': Permission denied
[192.168.15.143] out:
Fatal error: run() received nonzero return code 1 while executing!
Requested: rm -rf /home/user/project/weather_station/
Executed: /bin/bash -l -c "rm -rf /home/user/project/weather_station/"
Aborting.
Disconnecting from 192.168.15.143... done.
我认为这是错误是关于拒绝的权限。
我引用this
因此,我改变run('rm -rf {}'.format(PROJECT_DIR))
为sudo('rm -rf {}'.format(PROJECT_DIR))
但仍error.Is有什么办法?
如果使用'operations.sudo()'而不是'operations.run()'会发生什么? – fernandezcuesta
错误是完全相同的。我可以在fabfile中设置像'sudo -H rm -rf'这样的参数吗? – CJCheng