multiple users

196 views
Skip to first unread message

Jaime Cham

unread,
Sep 3, 2007, 2:56:27 PM9/3/07
to Capistrano
Is there a way to tell Capistrano to use different users to log into
the same server for different tasks? this would be useful to deploy as
a particular user without having to grant him sudo password access or
to allow more fine-grained permissions on server files or in certain
situations such as using EC2.

I tried creating multiple roles for the same server with different
users, but this gets into trouble with tasks that apply to all roles
executing twice.

Thanks!

Jaime

ky

unread,
Sep 19, 2007, 10:37:52 AM9/19/07
to Capistrano
I have the same question; would like to bump this to the top again.

Is closing existing connections the best way to connect to a host as a
different user, and if so, what's the best way to do that?

Jamis Buck

unread,
Sep 19, 2007, 10:48:39 AM9/19/07
to capis...@googlegroups.com
Just define the server multiple times with different user names, and
then classify each task with the appropriate role:

role :foo, "jo...@somehost.com"
role :bar, "bi...@somehost.com"

task :first_task, :roles => :foo do
# ...
end

task :second_task, :roles => :bar do
# ...
end

Note, though, that all hosts, regardless of username, must use the
same password. That, or you must be using public keys (which is the
recommended approach).

- Jamis

Paul Dowman

unread,
Sep 29, 2007, 4:12:49 PM9/29/07
to Capistrano
That works when you explicitly define roles for all tasks, but how
can I make sure that default tasks like deploy:setup are not run
twice?

Thanks,
Paul

On Sep 19, 10:48 am, "Jamis Buck" <ja...@37signals.com> wrote:
> Just define the server multiple times withdifferentusernames, and


> then classify each task with the appropriate role:
>

> role :foo, "j...@somehost.com"
> role :bar, "b...@somehost.com"


>
> task :first_task, :roles => :foo do
> # ...
> end
>
> task :second_task, :roles => :bar do
> # ...
> end
>
> Note, though, that all hosts, regardless of username, must use the
> same password. That, or you must be using public keys (which is the
> recommended approach).
>
> - Jamis
>
> On 9/19/07, ky <goo...@boxy.endjunk.com> wrote:
>
>
>
> > I have the same question; would like to bump this to the top again.
>
> > Is closing existing connections the best way to connect to a host as a

> >differentuser, and if so, what's the best way to do that?

Paul Dowman

unread,
Sep 29, 2007, 5:26:06 PM9/29/07
to Capistrano
I figured it out, I just added :norelease => true to the role definition.

Paul

Jaime Cham

unread,
Oct 20, 2007, 1:45:49 PM10/20/07
to Capistrano
Thanks Paul, I'll try that.

Incidentally, the reason I need this in the first place is because
while using your (awesome) EC2 image, your default setup is not to
allow sudo, so I wanted to log in sometimes as root and sometimes as
app!

Thanks again,

Jaime

> --http://pauldowman.com

Reply all
Reply to author
Forward
0 new messages