SCP 停止工作:权限被拒绝,请重试

SCP 停止工作:权限被拒绝,请重试

我正在使用 scp 将文件从服务器 A 传输到 B(两者都是带有 WHM 的 CentOS,并且它们的用户名相同)。

 nohup scp -rpC xaa2 username@serverIPB:xaa2

我做了很多次,然后突然就停止工作了!我尝试从 B 发送到 A,它成功了,而且我确信我输入的密码是正确的。

如果我运行我会得到这个:scp -v text.txt [email protected]:

Executing: program /usr/bin/ssh host mydomainB.com, user username, command scp -v -t .
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to mydomainB.com [serverIPB] port 22.
debug1: Connection established.
debug1: identity file /home/username/.ssh/identity type -1
debug1: identity file /home/username/.ssh/identity-cert type -1
debug1: identity file /home/username/.ssh/id_rsa type -1
debug1: identity file /home/username/.ssh/id_rsa-cert type -1
debug1: identity file /home/username/.ssh/id_dsa type -1
debug1: identity file /home/username/.ssh/id_dsa-cert type -1
debug1: identity file /home/username/.ssh/id_ecdsa type -1
debug1: identity file /home/username/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
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: Host 'mydomainB.com' is known and matches the RSA host key.
debug1: Found key in /home/username/.ssh/known_hosts:5
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Unspecified GSS failure.  Minor code may provide more information    

debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Next authentication method: publickey
debug1: Trying private key: /home/comdinhe/.ssh/identity
debug1: Trying private key: /home/comdinhe/.ssh/id_rsa
debug1: Trying private key: /home/comdinhe/.ssh/id_dsa
debug1: Trying private key: /home/comdinhe/.ssh/id_ecdsa
debug1: Next authentication method: password
[email protected]'s password: 
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.

我已经阅读了这些页面:

链接1:仅当 sshd 为守护进程时,公钥身份验证才会失败

链接2:ssh 登录成功,但 scp 密码给我“权限被拒绝”

链接3:使用 scp 传输文件时“权限被拒绝,请重试”

链接4:使用 scp 传输文件:权限被拒绝

链接5:scp 通过 ssh 复制不起作用 - 权限被拒绝错误,好吗?

尽管问题看起来很相似,但出现此问题的原因有很多。我试过:

  • 使用 sudo 执行命令:同样的问题
  • 执行:同样的问题ssh -v [email protected]
  • 用户名拥有目录目标
  • 目标目录下没有同名文件

最让我恼火的是它本来在运行,然后就停止了。ServerB 是一台新服务器,我使用 serverC 将文件发送到服务器 B 时也遇到了同样的问题。似乎过了一段时间它就阻止了访问。

编辑: 我尝试在它停止工作之前和之后选择日志(/var/log/secure):

Mar 18 02:26:11 localhost sshd[56154]: Accepted password for username from ServerA_IP port 42219 ssh2
Mar 18 02:26:11 localhost sshd[56154]: pam_unix(sshd:session): session opened for user username by (uid=0)
Mar 18 02:32:57 localhost sshd[56363]: Connection closed by 115.239.228.16 <---- chinese IP
Mar 18 02:34:12 localhost sshd[56161]: Received disconnect from ServerA_IP: 11: disconnected by user
Mar 18 02:34:12 localhost sshd[56154]: pam_unix(sshd:session): session closed for user username
Mar 18 03:00:20 localhost sshd[58424]: Connection closed by 115.239.228.6 <---- chinese IP
Mar 18 03:21:35 localhost sshd[58922]: Accepted password for username from ServerA_IP port 42260 ssh2
Mar 18 03:21:35 localhost sshd[58922]: pam_unix(sshd:session): session opened for user username by (uid=0)

/**** lots of brute force attack from strangers*****/

Mar 18 05:18:01 localhost sshd[64459]: Failed password for username from ServerA_IP port 42362 ssh2
Mar 18 05:18:17 localhost sshd[64459]: Failed password for username from ServerA_IP port 42362 ssh2
Mar 18 05:18:17 localhost sshd[64462]: Connection closed by ServerA_IP
Mar 18 05:20:58 localhost sshd[64641]: Failed password for username from ServerA_IP port 42370 ssh2
Mar 18 05:21:01 localhost sshd[64644]: Connection closed by ServerA_IP
Mar 18 05:21:41 localhost sshd[64654]: Failed password for username from ServerA_IP port 42371 ssh2
Mar 18 05:21:43 localhost sshd[64657]: Connection closed by ServerA_IP

相关内容