Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8311867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:57:15+00:00 2026-06-08T19:57:15+00:00

When I try to ssh to a server, I’m able to do it as

  • 0

When I try to ssh to a server, I’m able to do it as my id_rsa.pub key is added to the authorized keys in the server.

Now when I try to deploy my code via Capistrano to the server from my local project folder, the server asks for a password.

I’m unable to understand what could be the issue if I’m able to ssh and unable to deploy to the same server.

$ cap deploy:setup

"no seed data"
triggering start callbacks for `deploy:setup'
* 13:42:18 == Currently executing `multistage:ensure'
*** Defaulting to `development'
* 13:42:18 == Currently executing `development'
* 13:42:18 == Currently executing `deploy:setup'
triggering before callbacks for `deploy:setup'
* 13:42:18 == Currently executing `db:configure_mongoid'
* executing "mkdir -p /home/deploy/apps/development/flyingbird/shared/config"
 servers: ["dev1.noob.com", "176.9.24.217"]
 Password: 

Cap script:

# gem install capistrano capistrano-ext capistrano_colors
 begin; require 'capistrano_colors'; rescue LoadError; end
 require "bundler/capistrano"

 # RVM bootstrap
 # $:.unshift(File.expand_path('./lib', ENV['rvm_path']))
 require 'rvm/capistrano'
 set :rvm_ruby_string, 'ruby-1.9.2-p290'
 set :rvm_type, :user # or :user

 # Application setup
default_run_options[:pty] = true # allow pseudo-terminals
ssh_options[:forward_agent] = true # forward SSH keys (this will use your SSH key to get the code from git repository)
ssh_options[:port] = 22
 set :ip, "dev1.noob.com" 
set :application, "flyingbird"

 set :repository, "repo-path"
 set :scm, :git
 set :branch, fetch(:branch, "master")

 set :deploy_via, :remote_cache
 set :rails_env, "production"
 set :use_sudo, false
 set :scm_username, "user"
 set :user, "user1"


 set(:database_username) { application }
 set(:production_database) { application + "_production" }
 set(:staging_database) { application + "_staging" }
 set(:development_database) { application + "_development" }


 role :web, ip                        # Your HTTP server, Apache/etc
 role :app, ip                          # This may be the same as your `Web` server
 role :db,  ip, :primary => true # This is where Rails migrations will run


 # Use multi-staging
 require "capistrano/ext/multistage"
 set :stages, ["development", "staging", "production"]
 set :default_stage, rails_env

 before "deploy:setup", "db:configure_mongoid"

 # Uncomment if you use any of these databases
 after "deploy:update_code", "db:symlink_mongoid"
 after "deploy:update_code", "uploads:configure_shared"
 after "uploads:configure_shared", "uploads:symlink"


 after 'deploy:update_code', 'bundler:symlink_bundled_gems'
 after 'deploy:update_code', 'bundler:install'
 after "deploy:update_code", "rvm:trust_rvmrc" 

 # Use this to update crontab if you use 'whenever' gem
 # after "deploy:symlink", "deploy:update_crontab"

 if ARGV.include?("seed_data")
    after "deploy", "db:seed"
 else
     p "no seed data"
 end


   #Custom tasks to handle resque and redis restart
   before "deploy", "deploy:stop_workers"
   after "deploy", "deploy:restart_redis"
   after "deploy", "deploy:start_workers"
   after "deploy", "deploy:cleanup"

   'Create symlink for public uploads'
    namespace :uploads do 
      task :symlink do
        run <<-CMD
          rm -rf #{release_path}/public/uploads &&
          mkdir -p #{release_path}/public &&
          ln -nfs #{shared_path}/public/uploads #{release_path}/public/uploads
         CMD
      end
    task :configure_shared do 
    run "mkdir -p #{shared_path}/public"
    run "mkdir -p #{shared_path}/public/uploads"
  end
 end


     namespace :rvm do
       desc 'Trust rvmrc file'
        task :trust_rvmrc do
        run "rvm rvmrc trust #{current_release}"
       end
     end



        namespace :db do

         desc "Create mongoid.yml in shared path"
          task :configure_mongoid do
            db_config = <<-EOF
             defaults: &defaults
            host: localhost

         production:
           <<: *defaults
            database: #{production_database}
         staging:
            <<: *defaults
            database: #{staging_database}
          EOF

          run "mkdir -p #{shared_path}/config"
          put db_config, "#{shared_path}/config/mongoid.yml"
         end

          desc "Make symlink for mongoid.yml"
            task :symlink_mongoid do
            run "ln -nfs #{shared_path}/config/mongoid.yml #{release_path}/config/mongoid.yml"
           end

            desc "Fill the database with seed data"
             task :seed do
               run "cd #{current_path}; RAILS_ENV=#{default_stage}  bundle exec rake                   db:seed"
              end

            end

            namespace :bundler do
             desc "Symlink bundled gems on each release"
             task :symlink_bundled_gems, :roles => :app do
             run "mkdir -p #{shared_path}/bundled_gems"
             run "ln -nfs #{shared_path}/bundled_gems #{release_path}/vendor/bundle"
           end






            desc "Install bundled gems "
              task :install, :roles => :app do
                run "cd #{release_path} && bundle install --deployment"
              end
            end



             namespace :deploy do
               task :start, :roles => :app do
               run "touch #{current_path}/tmp/restart.txt"
             end

             desc "Restart the app"
               task :restart, :roles => :app do
                 run "touch #{current_path}/tmp/restart.txt"
             end

             desc "Start the workers"
              task :stop_workers do
                run "cd #{current_path}; RAILS_ENV=#{default_stage}  bundle exec rake                                   resque:stop_workers"
             end

             desc "Restart Redis server"
               task :restart_redis do
                 "/etc/init.d/redis-server restart" 
             end

             desc "Start the workers"
               task :start_workers do
                  run "cd #{current_path}; RAILS_ENV=#{default_stage}  bundle exec rake  resque:start_workers"
             end


         end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:57:16+00:00Added an answer on June 8, 2026 at 7:57 pm

    You need to specify both the SSH user and the private key for authentication:

    ie:

     set :user,    "deploy"
     set :ssh_key, "deploy.pem"
    

    If you’re using capistrano multistage, which it appears you are, in your stages.yml file for this environment, add the keys:

     user:     "deploy"
     ssh_key:  "deploy.pem"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have production_server and git_repo_server, git_repo_server .ssh/authorized keys have production user id_rsa.pub. When I
When I try to ssh to a server, I'm able to do it as
I'm using SSH to deploy my Java artifacts to a server. I have the
I'm trying to run a command on a remote server via SSH from a
I try to connect a server though SSH using Ruby, but I have an
I'm trying to connect to SSH Unix server on button click (code written in
I'm trying to log into my AWS server via SSH, it's set up with
I am getting a segmentation fault from bash when I try to SSH to
I'm trying to achieve the following with a bash script: try for SSH connection,
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.