Cannot scp file to an EC2 instance that I can ssh to

2

I have two EC2 instances that were created from the same AMI, which was created from the Amazon Linux AMI. These are running mysql in a master-slave configuration. The security group ("db") is configured to allow port 22 from instances running under security group "web".

So, I ssh into one of the web instances, and then ssh or scp to the database instances. This has been working fine for a while.

Today, however, I can no longer scp to one of the instances (the master). I can ssh into it just fine, and both scp and ssh work fine to the slave instance.

Running scp with -vv produces almost idential output, up to the debug2: line below, which is the last output when connecting to the master.

debug2: exec request accepted on channel 0
Sending file modes: C0775 77 <filename>

Any idea what is going on? I've tried re-starting the instance, and that didn't make any difference.

Update:

/var/log/secure:
  Jan 10 19:02:59 <host> sshd[1987]: Accepted publickey for <user> from xx.xxx.xxx.xxx port 33285 ssh2
  Jan 10 19:02:59 <host> sshd[1987]: pam_unix(sshd:session): session opened for user <user> by (uid=0)

There were about 20 lines or so added to /var/log/audit/audit.log, all ending in res=success

chris

Posted 2013-01-09T18:19:32.360

Reputation: 8 607

(1) Double check destination path is correct and writable? (2) The last line is correct, not an error. (3) Check /var/log/auth.log and /var/log/syslog for sshd error/warning. – John Siu – 2013-01-09T20:15:50.577

I am having a similar problem - I can ssh into my instance just fine; scp authenticates and connects (I see the MOTD) but doesn't transfer the file. – DNA – 2014-01-27T16:09:30.290

Answers

0

I fixed this issue by doing the following:

$ sudo vi /etc/ssh/sshd_config

Changed this:

# override default of no subsystems
Subsystem      sftp    /usr/libexec/openssh/sftp-server

To this:

# override default of no subsystems
Subsystem      sftp    internal-sftp

Then restarted the sshd service:

$ sudo service sshd restart

Beau Harder

Posted 2013-01-09T18:19:32.360

Reputation: 101

0

I find it easier to just run a python SimpleHTTPServer and run wget on other side to download file.

  • Add HTTP procotcol to be added in security config for all sources

  • run the following command in the directory in which file exists

    $ sudo python -m SimpleHTTPServer 80

  • on the receiving side, run the following command to download file

    $ wget http://ec2ip.aws.amaxon.com/file.txt

rajeshnair

Posted 2013-01-09T18:19:32.360

Reputation: 101