[英]Capistrano mkdir permission denied
When I run cap production deploy
I get cannot create directory '/var/www/application/repo': Permission denied
. 当我运行
cap production deploy
我得到cannot create directory '/var/www/application/repo': Permission denied
。
So far I've created deploy user like: 到目前为止,我已经创建了部署用户:
adduser deploy
adduser deploy sudo
and I use this user in Capistrano. 我在Capistrano中使用此用户。
Indeed, when I log to deploy@my.vps.ip
I don't have sudo
permission by default, every time I need to enable it explicitly like sudo su
. 实际上,当我登录到
deploy@my.vps.ip
时,默认情况下我没有sudo
权限,每次我需要像sudo su
一样明确启用它。
I see two possible solutions: 我看到两种可能的解决方案
Unfortunately I don't know how to do neither of them. 不幸的是,我不知道如何做到这两件事。
By default Capistrano 3 deploys to /var/www
which is not writable by deploy
user. 默认情况下,Capistrano 3部署到
/var/www
, deploy
用户无法写入。 You need to change the ownership of /var/www
to deploy
user using the following command. 您需要使用以下命令更改
/var/www
的所有权以deploy
用户。
sudo chown deploy:deploy /var/www/
After this, you should be able to deploy your app without permission error. 在此之后,您应该能够在没有权限错误的情况下部署您的应用。
Credit to Bob Roberts. 感谢Bob Roberts。
I think this should be an answer as its easy to miss your comment. 我认为这应该是一个答案,因为很容易错过你的评论。 I know I missed it few times.
我知道我错过了几次。
sudo chown -R deploy:deploy /var/www/
or whatever your username is 或者你的用户名是什么
sudo chown -R username:username /var/www/
Had the same error here, following the good tutorial of GoRails "Deploy Ruby on Rails To Production in 2019", where he create a user "deploy" and set to deploy the app in "home/deploy". 这里有同样的错误,遵循GoRails的好教程“在2019年将Ruby on Rails生产到生产”,在那里他创建了一个用户“deploy”并设置为在“home / deploy”中部署应用程序。 Don't forget that you have to use the username created on the server.
不要忘记您必须使用在服务器上创建的用户名。 So deploy's directory is "home/USERNAME".
所以deploy的目录是“home / USERNAME”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.