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 7681541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:21:53+00:00 2026-05-31T18:21:53+00:00

I want to copy a file from my one rails application to a remote/

  • 0

I want to copy a file from my one rails application to a remote/ another application hosted on an aws ec2 instance. I have my security group TCP ports 21 and 21 open for ssh and sftp. But I’m not able to figure out any way to do it. I’ve tried scp so far and, it does not work.

I tried this:

scp -i ec2-keypair.pem myfile.txt ubuntu@my-public-ec2-ip:/home/ubuntu/my_new_file.txt

It prompts this: Using /home/ubuntu/.rvm/gems/ruby-1.8.7-p334 and exit. But file transfer doesn’t happen. What could be the possible issue??

And also if, you know any better solution to do the same then, please help me with your knowledge. Thanks

EDIT : It would be great if, the solution is available in ruby or ruby on rails. Cause ultimately I have to transfer a file from one rails application to another.

EDIT : When I do scp -v -i ~/.ec2/ec2-keypair.pem Gemfile.lock ubuntu@175.41.140.84:/home/ubuntu/apps/ I get this: http://pastie.org/3613259

and see here: http://pastie.org/3613269 for more verbose output with -vvv

  • 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-05-31T18:21:54+00:00Added an answer on May 31, 2026 at 6:21 pm

    So I found this thread, and the last item might be relevant. http://centos.org/modules/newbb/viewtopic.php?topic_id=30515&forum=42

    (btw, ssh -vvv will get you debug level 3, with even more inscrutable details).

    So to be sure, the most common problem is that the permissions on the .ssh directory (on both local and remote hosts) somehow get overly permissive and ssh will refuse to use the credentials. Perms on the .ssh directory should be rwx for user only (octal chmod 700), rw for user on the private key and .pem keypairs, and group/all readable for other files.

    drwx------  11 tharrison  staff   374 Mar  1 16:37 .
    drwxr-xr-x+ 79 tharrison  staff  2686 Mar  8 10:43 ..
    -rw-r--r--   1 tharrison  staff   128 Aug 16  2010 .ssh-agent
    -rw-r--r--   1 tharrison  staff   132 Dec 29 14:42 config
    -rw-------   1 tharrison  staff  1675 Apr 20  2009 id_rsa
    -rw-r--r--@  1 tharrison  staff   405 Apr 20  2009 id_rsa.pub
    -rw-r--r--   1 tharrison  staff  2805 Mar  5 08:33 known_hosts
    -rw-------@  1 tharrison  staff  1693 Apr 27  2011 my-aws-keypair.pem
    

    SSH is (properly) paranoid about what it will send to any log — it doesn’t want to give away any hints about what is or is not working as those hints could be used to discover vulnerabilities, etc. So the logs can be helpful … occasionally.

    But I am not sure any of this is right, because I think you said you’re able to log in successfully from the command line using ssh, and that scp doesn’t work — this kind of rules out ssh authentication issues (as I said, scp is really just ssh), which is why it’s worth making sure that the user you’re logging in as remotely has proper permissions to write the file to the location you’re sending it.

    Maybe try ssh -i mykeypair.pem myuser@myremote.host 'touch ~/foo' All values starting “my” need to be replaced with the correct values, e.g. mykeypair.pem will need to have the path and name of the keypair you use to log in. If this works, it will create a file named foo in myuser’s home directory on the server myremote.host — log in using ssh without the command and check — then you have proper permissions, at least to that directory. Now try to the real directory.

    If it fails there, then check that all the directories in the path are group-x or all-x and the target directory is group or all rwx.

    EDIT: corrected test ssh command and expanded on procedure and clarified.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to copy a xml file from one remote box to a bunch
i want copy pdf file from application path(/data/data/package name) to sdcard.for that i have
I want to copy lines from one file to another: count=1 while read -r
I want to copy some file from one folder to another folder of my
I want to copy a txt file from one folder to another. While coping
I want to copy a file from one location to another every five seconds.
Using VB.Net I want to copy the txt file from one location to another
Lets say i want to copy a file from one location to another with
I want to copy/paste a file from one folder to another folder in windows
I want grant user rights to copy a specific file from a remote server

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.