0

Using Capistrano i logged as a default user which does not have access privilege. I need to switch to a different user in remote 'deploy user' to perform certain tasks.

Below is my script

set :user, "sasi"
set :group, "sasi"

set :switch_user do
  password = Capistrano::CLI.ui.ask "deployuser password:"
  run "whoami"
  run("su - 'deployuser'") do |channel, stream, output|
    channel.send_data("#{password}\n") if output
  end
end

Help me in switching to a different user permanently using Capistrano.

Sasidaran
  • 444
  • 6
  • 12

1 Answers1

0

I have no idea how Capistrano can do this. But I found an answer which I hope could help you.

Permanently switching user in Capistrano 3 (separate authorization & deploy)

Community
  • 1
  • 1
Alvin
  • 23
  • 5