0

我正在尝试将文件上传到我的新 ec2 vps,但没有任何运气。

我可以通过 ssh 连接没有任何问题。

当我尝试上传我的外壳时说:

scp -v -i ~/.ssh/maurospage.pem wp-config.php ubuntu@ec2-54-247-43-158.eu-west-1.compute.amazonaws.com:/var/www/blog
Executing: program /usr/bin/ssh host ec2-54-247-43-158.eu-west-1.compute.amazonaws.com, user ubuntu, command scp -v -t -- /var/www/blog
OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/mauromarano/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to ec2-54-247-43-158.eu-west-1.compute.amazonaws.com [54.247.43.158] port 22.
debug1: Connection established.
debug1: identity file /Users/mauromarano/.ssh/maurospage.pem type -1
debug1: identity file /Users/mauromarano/.ssh/maurospage.pem-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 1c:58:69:51:4a:5e:60:4a:a1:39:c8:03:55:cb:f9:10
debug1: Host 'ec2-54-247-43-158.eu-west-1.compute.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/mauromarano/.ssh/known_hosts:7
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/mauromarano/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/mauromarano/.ssh/maurospage.pem
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to ec2-54-247-43-158.eu-west-1.compute.amazonaws.com ([54.247.43.158]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = it_IT.UTF-8
debug1: Sending env LC_CTYPE = it_IT.UTF-8
debug1: Sending command: scp -v -t -- /var/www/blog
Sending file modes: C0777 3504 wp-config.php
Sink: C0777 3504 wp-config.php
scp: /var/www/blog/wp-config.php: Permission denied

MacBook-Pro-di-Mauro: ~/Desktop                                                         
→ debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 2672, received 2304 bytes, in 0.7 seconds
Bytes per second: sent 3996.1, received 3445.7
debug1: Exit status 1

ls -l of the folder in with 我试图复制文件(一个 wp 文件夹)

ubuntu@ip-10-227-45-167:/var/www/blog$ ls -l
total 192
-rwxrwxrwx 1 ubuntu root   395 Jan  8  2012 index.php
-rwxrwxrwx 1 ubuntu root   408 Dec 14 09:21 LEGGIMI.txt
-rwxrwxrwx 1 ubuntu root 19929 May  6  2012 license.txt
-rwxrwxrwx 1 ubuntu root 24880 Dec 14 09:21 licenza.html
-rwxrwxrwx 1 ubuntu root  8946 Dec 14 09:21 readme.html
-rwxrwxrwx 1 ubuntu root  4663 Nov 17 15:11 wp-activate.php
drwxrwxrwx 9 ubuntu root  4096 Dec 14 09:21 wp-admin
-rwxrwxrwx 1 ubuntu root   271 Jan  8  2012 wp-blog-header.php
-rwxrwxrwx 1 ubuntu root  3522 Apr 10  2012 wp-comments-post.php
-rwxrwxrwx 1 ubuntu root  3737 Dec 14 09:21 wp-config-sample.php
drwxrwxrwx 5 ubuntu root  4096 Dec 14 09:21 wp-content
-rwxrwxrwx 1 ubuntu root  2718 Sep 23 16:57 wp-cron.php
drwxrwxrwx 9 ubuntu root  4096 Dec 14 09:21 wp-includes
-rwxrwxrwx 1 ubuntu root  1997 Oct 23  2010 wp-links-opml.php
-rwxrwxrwx 1 ubuntu root  2408 Oct 26 19:40 wp-load.php
-rwxrwxrwx 1 ubuntu root 29310 Nov 30 13:40 wp-login.php
-rwxrwxrwx 1 ubuntu root  7723 Sep 25 05:26 wp-mail.php
-rwxrwxrwx 1 ubuntu root  9899 Nov 22 09:52 wp-settings.php
-rwxrwxrwx 1 ubuntu root 18219 Sep 11 12:27 wp-signup.php
-rwxrwxrwx 1 ubuntu root  3700 Jan  8  2012 wp-trackback.php
-rwxrwxrwx 1 ubuntu root  2719 Sep 11 20:11 xmlrpc.php

我试过chmod 777 myfile在我的电脑上,我chmod -R 777 *在我的 ec2 实例的博客文件夹中做了。没有改变。

我哪里错了?

4

2 回答 2

1

父文件夹缺少正确的权限。Scp 无法在当前文件夹中创建新文件。您可能希望修复您的权限,以便不对所有文件使用 777。

于 2013-02-03T05:10:05.430 回答
0

如果这会杀死其他任何人,请尝试使用波浪号 (~) 而不是根目录 (/)

即,而不是在这个例子中:

scp -v -i ~/.ssh/maurospage.pem wp-config.php ubuntu@ec2-54-247-43-158.eu-west-1.compute.amazonaws.com:/var/www/blog

尝试...

 scp -v -i ~/.ssh/maurospage.pem wp-config.php ubuntu@ec2-54-247-43-158.eu-west-1.compute.amazonaws.com:~

..然后像往常一样按照 ec2 管理控制台中的连接步骤连接到您的实例,并将文件作为 sudo 移动到 var/www/html 目录

于 2013-05-23T13:20:55.043 回答