Capistrano change user after ssh log-in - deploy as another user

雨燕双飞 提交于 2019-12-08 08:13:05

问题


In my staging.rb file i need to connect with "ubuntu" username

server '**.**.****.**', user: 'ubuntu',  roles: %w{web app db}

In my deploy.rb

set :deploy_to, -> { "/var/www/myuser/myuser.com/capi" }

Server

var/www/myuser/myuser.com# ls -la
total 32
drwxrwx--- 8 myuser myuser 4096 Jul  9 14:54 .
drwxrwx--- 5 myuser myuser 4096 Feb 26 17:18 ..
drwxrwx--- 7 myuser myuser 4096 May  7 13:48 beta
drwxr-xr-x 2 myuser myuser 4096 Jul  9 14:54 capi
drwxrwx--- 9 myuser myuser 4096 May  8 20:15 quiz
drwxrwx--- 2 myuser myuser 4096 May  8 20:10 scoreboards
drwxrwx--- 2 myuser myuser 4096 May  8 20:10 stats
drwxrwx--- 7 myuser myuser 4096 Jul  2 14:58 www

when i do "bundle exec cap staging deploy" i have this error

 mkdir stderr: mkdir: cannot create directory '/var/www/myuser': Permission denied
 mkdir: cannot create directory '/var/www/myuser': Permission denied

How i can change user with capistrano?

来源:https://stackoverflow.com/questions/31321315/capistrano-change-user-after-ssh-log-in-deploy-as-another-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!