ssh user should be set to user running the cap command

15 views
Skip to first unread message

Chippy S

unread,
Feb 15, 2015, 12:49:24 PM2/15/15
to capis...@googlegroups.com
Versions:
  • Ruby 1.9.3p448 (Centos 6 / SCL)
  • Capistrano - 3.2.1
  • Rake / Rails / etc
Platform:
  • Working on.... CentOS 6
  • Deploying to... Windows
Logs:
  • Please past logs (as completely as possible to a 3rd party pasting service such as pastie.org)
Files:
  • Capfile
  • deploy.rb
  • Stage files (production.rb, staging.rb)


Myself and my co-workers all have our own accounts on both the deployment server (where we run 'cap production deploy') and on the servers we are deploying too. Yes we really are using cap to deploy apps to Windows boxes which run cygwin.  I realize that the docs suggest using a dedicated account, but that is not our setup.  Someone before me set all this up, using cap 2 and I'm now trying to do it with cap 3.  Due to our AD rules, using a dedicated account is not possible.

What I want cap to do is use the username of the user executing the command, and that username will have the necessary permissions to do everything on both the deployment server and on the servers being pushed too.  I can get things working if I hard code the username to mine in config/deploy/production.rb and set it in the ssh_options.  But that won't work for my teammates.

Any help much appreciated.

Thank you,
Chad



Lee Hambley

unread,
Feb 16, 2015, 4:47:09 AM2/16/15
to Capistrano
Hi Chad, if you want to execute it using the user of the machine, you can probably do that using `~/.ssh/config` (so only put the machine hostnames in the capistrano config, and set the username on the user's ssh config)

Alternatively Ruby has an API to get the current username of the person running the script, you could interpolate this into the hostname: http://ruby-doc.org/stdlib-1.9.3/libdoc/etc/rdoc/Etc.html#method-c-getlogin

--
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/5f0470a5-015e-436e-ad09-11bad97c2d15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages