Capistrano change user after ssh log-in

132 views
Skip to first unread message

Mirko Picaro

unread,
Jul 9, 2015, 11:20:27 AM7/9/15
to capis...@googlegroups.com

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?

Jonathan Rochkind

unread,
Jul 9, 2015, 11:46:03 AM7/9/15
to capis...@googlegroups.com
What makes you think you need to connect as user 'ubuntu', when the directory location you want to write to is only writeable by user 'myuser'?

I'd say either have capistrano connect as 'myuser', or log in to the server yourself and change the ownership/permissions on those files to be writeable by user 'ubuntu'.

It looks to me like Capistrano is doing what you told it to do, but you told it to try to log in as user 'ubuntu' and write to a file location that is only writeable by user 'myuser'. So you just need to get your plan straight and fix the server to be set up accordingly.  You might want to read up on how unix permissions work, and make sure you understand that, so you can plan your deploy with that understanding.
--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/50bfbad0-d256-4528-a924-51b2d1a9d9cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages