You might try replacing the defaults in the SSHKit command
map<https://github.com/capistrano/sshkit/blob/master/lib/sshkit/command_map.rb#L62>with
a command that does what you need. If you can't SSH in as your deploy
user, that's not a deploy user. Fix the permissions for your `paul` account.

Lee Hambley
--
http://lee.hambley.name/
+49 (0) 170 298 5667


On 3 February 2014 21:28, Paul Schreiber <[email protected]> wrote:

> Versions:
>
>    - Ruby 2.1
>    - Capistrano 3.1
>
> Platform:
>
>    - working on OS X 10.9.1
>    - deploy to CentOS 6.5
>
> On my target deployment server, i cannot ssh in as my deploy user,
> admin@myserver, but I can ssh in as paul@myserver and then sudo su -
> admin.
>
> I made a test task
>   task :sayhello do
>     on roles(:app) do
>       as "admin" do
>         puts capture "whoami"
>       end
>     end
>   end
>
> And that works as expected:
>
> $ cap beta deploy:sayhello
> DEBUG [acaa0e6a] Running /usr/bin/env if ! sudo su admin -c whoami >
> /dev/null; then echo "You cannot switch to user 'admin' using sudo, please
> check the sudoers file" 1>&2; false; fi on awse-tweb01.foo.com
> DEBUG [acaa0e6a] Command: if ! sudo su admin -c whoami > /dev/null; then
> echo "You cannot switch to user 'admin' using sudo, please check the
> sudoers file" 1>&2; false; fi
> DEBUG [acaa0e6a] Finished in 6.982 seconds with exit status 0 (successful).
> DEBUG [153b980d] Running /usr/bin/env whoami on awse-tweb01.foo.com
> DEBUG [153b980d] Command: sudo su admin -c "/usr/bin/env whoami"
> DEBUG [153b980d] admin
> DEBUG [153b980d] Finished in 0.535 seconds with exit status 0 (successful).
> admin
>
> How can I have Capistrano run the deploy tasks as admin?
>   i.e. prefixed with sudo su admin -c or sudo su the shell before running
> commands
>
>
>
> Paul
>
> --
> 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 [email protected].
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/capistrano/8a7d6803-5d92-4e62-ac09-ae8a91faf727%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/CAN_%2BVLXwHBcar5d-jrJwm7Fo0%3DbC-9fPPiBAO711G6NssMBMUg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to