Versions:
- Ruby - 1.8.7
- Capistrano - 2.6.0
- Rake / Rails / etc
Platform:
- Working on....CentOS
- Deploying to... CentOS
Logs:
Even though "deployuser" has the rights to switch to "admin" user without entering password, cap script is expecting password to be entered.
-bash-4.1$ cap -f /tmp/captest-user.cap deploy
* executing `deploy'
* executing "whoami"
servers: ["host1"]
[host1] executing command
** [out :: host1] deployuser
command finished in 69ms
* executing "sudo -p 'sudo password: ' -u admin /data/myapplication/script.sh stop"
servers: ["host1"]
[host1] executing command
Password:
- Capfile
- default_run_options[:pty] = true
- role :app, "host1"
- task :deploy, roles => :app do
- run "whoami"
- run "/data/myapplication/script.sh stop", :shell => "sudo su - cmsadmin"
- run "tail -f /home/apache-tomcat-7.0.67/logs/catalina.out | sed '/^INFO: Stopping ProtocolHandler/ q'"
- run "sudo puppet agent --confdir=/home/puppet --waitforcert 60 --test; true"
- end
In 2.6 is there a way i can execute commands on behalf of another user ("admin" in my case)? If so how? I understand that this is possible with the help of
https://github.com/fundingcircle/sshkit-backends-netssh_global in Cap 3.0. But i would like to know if it is achievable using 2.6 or should i have to upgrade it?
Any pointers will help me a lot. Thanks!