我无法使用scp复制远程文件,但可以使用ssh登录

里卡多·克鲁多(Ricardo Crudo)

我有一个来自dlink的NAS DNS-320L,它运行原始固件+ fun_plug,使NAS能够接收ssh连接。我可以使用ricardo用户通过ssh登录到服务器。

[ricardo@crudo:~]$ ssh [email protected]
[email protected]'s password: 
Last login: Sat Oct 17 16:23:30 2015 from 192.168.1.112


BusyBox v1.20.2 (2013-11-27 15:54:37 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ uname -a
Linux HipoteNAS 2.6.31.8 #1 Wed Aug 22 16:55:05 CST 2012 armv5tel GNU/Linux

但是,当我尝试将文件从服务器复制到本地计算机时,我收到一条Permission denied消息。像那样:

[ricardo@crudo:~]$ scp -v ricardo@hipotenusab9:/mnt/HD/HD_a2/ricardo/test .
Executing: program /usr/bin/ssh host hipotenusab9, user ricardo, command scp -v -f /mnt/HD/HD_a2/ricardo/test
OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to hipotenusab9 [192.168.1.140] port 22.
debug1: Connection established.
debug1: identity file /home/ricardo/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ricardo/.ssh/id_rsa-cert type -1
debug1: identity file /home/ricardo/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /home/ricardo/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ricardo/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ricardo/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ricardo/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ricardo/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to hipotenusab9:22 as 'ricardo'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:2di8KzkN9fsQT1KBqP5f3GrMp5CA+Gctuvl87yFJEag
debug1: Host 'hipotenusab9' is known and matches the ECDSA host key.
debug1: Found key in /home/ricardo/.ssh/known_hosts:32
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,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ricardo/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Skipping ssh-dss key /home/ricardo/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes
debug1: Trying private key: /home/ricardo/.ssh/id_ecdsa
debug1: Trying private key: /home/ricardo/.ssh/id_ed25519
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
ricardo@hipotenusab9's password: 
debug1: Authentication succeeded (password).
Authenticated to hipotenusab9 ([192.168.1.140]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending command: scp -v -f /mnt/HD/HD_a2/ricardo/test
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
sh: scp: Permission denied
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 2808, received 1808 bytes, in 0.0 seconds
Bytes per second: sent 187813.6, received 120928.4
debug1: Exit status 127

我确实有权访问此目录,如下所示。

[ricardo@crudo:~]$ ssh [email protected]
[email protected]'s password: 
Last login: Sat Oct 17 16:44:08 2015 from 192.168.1.112


BusyBox v1.20.2 (2013-11-27 15:54:37 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ ls -la /mnt/HD/HD_a2/
drwxrwxrwx   15 root     root          4096 Oct 11 21:02 .
drwxrwx---    3 root     root          4096 Jun  8  2014 .!@$mmc
drwxr-xr-x    3 root     root          1024 Oct 11 21:04 ..
drwx------    9 root     root          4096 Oct 26  2014 .systemfile
drwxrwx---    4 root     root          4096 Jun 12  2014 Nas_Prog
drwxrwxrwx    5 root     root          4096 Jun 22  2014 P2P
drwxr-xr-x   15 root     root          4096 Jun 10  2014 ffp
-rw-------    1 root     root         30049 Oct 11 21:05 ffp.log
-rwxrwx---    1 root     root          1942 Jun  9  2014 fun_plug
drwx------    2 root     root         16384 Jun  8  2014 lost+found
drwxrwxrwx  219 nobody   allaccou     12288 Oct 25  2014 music
drwxrwxrwx    3 nobody   allaccou      4096 Aug 23  2014 photo
drwxrwxrwx   19 ricardo  media         4096 Oct 11 21:35 ricardo
drwxrwxrwx   52 nobody   allaccou      4096 Aug 17 06:56 video
~ $ ls -la /mnt/HD/HD_a2/ricardo/
drwxrwxrwx   19 ricardo  media         4096 Oct 11 21:35 .
drwxrwxrwx   15 root     root          4096 Oct 11 21:02 ..
drwxrwxrwx   16 ricardo  media         4096 Jun 20  2014 Engenharia
drwxrwxrwx   75 ricardo  media         4096 Jul  5  2014 Fotos
drwxrwxrwx    7 ricardo  media         4096 Oct  7 18:50 Outros
drwxrwxrwx    9 ricardo  media         4096 Jun 19  2014 Projetos
drwxrwxrwx   14 ricardo  media         4096 Jun 19  2014 SENAI
-rwxrwxrwx    1 ricardo  media            0 Oct 11 21:35 test

我可以使用root用户复制文件任何想法会发生什么?


编辑。

下面是服务器端的文件权限:

[ricardo@crudo:~]$ ssh ricardo@hipotenusab9
ricardo@hipotenusab9's password: 


BusyBox v1.20.2 (2013-11-27 15:54:37 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ scp
-sh: scp: Permission denied
~ $ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/ffp/bin
~ $ ls -la /mnt/HD/HD_a2/ffp/bin/scp
-rwxr-xr-x    1 root     root         56200 Dec 29  2011 /mnt/HD/HD_a2/ffp/bin/scp
~ $ ls -la /ffp
lrwxrwxrwx    1 root     root            17 Oct 18 22:23 /ffp -> /mnt/HD/HD_a2/ffp

作为根:

[ricardo@crudo:~]$ ssh root@hipotenusab9
root@HipoteNAS:~# find / -name scp
/mnt/HD/HD_a2/ffp/bin/scp
root@HipoteNAS:~# 
吉勒斯“别再邪恶了”
scp: Permission denied

scp通过scp在远程端调用可执行文件来工作。显然,远程安装存在一些问题:scp存在,但只能由root用户执行。检查scp可执行文件的权限(通常是/usr/bin/scp/usr/local/bin/scp)(也要检查指向可执行文件及其加载程序的所有目录的权限,但是鉴于其他程序正在运行,这些权限可能没问题)。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法使用Java语言访问类,但可以使用Kotlin

Java编译无法使用方法参考,但可以使用lambda

symbolicatecrash无法与dSYM一起使用,但可以使用“ atos”

无法使用命令行连接到MySQL,但可以使用MySQL Workbench

Gulp Watch无法使用导入的文件,但可以使用主文件

由于未知原因,无法使用pipenv安装Django(但可以使用pip)

无法连接到Localdb,但可以使用namedpipe

Web API无法使用GET绑定不可变对象,但可以使用POST绑定

我无法使用julia 1.0.2在控制台中运行.jl文件,但可以使用julia 0.6

无法使用Openvino中间表示文件转发()网络,但可以使用ONNX文件我正在制作IR

无法使用PHP将视频上传到Facebook页面,但可以使用curl

我无法ping microsoft.com,但可以使用浏览器打开它

Ubuntu UI无响应但可以ssh登录,如何通过ssh登录远程?

通过ssh连接使用scp-我可以在远程计算机之间直接复制文件吗?

我无法使用su命令以root用户身份登录,但可以使用SSH登录

MediaContentProvider无法使用SMS应用程序(但可以使用WhatsApp,电子邮件等)

创建无法登录但可以使用FTP的Windows用户?

IIS 7无法提供.aspx页,但可以使用默认文件

我无法使用Behat连接到我的网站(但可以使用浏览器)

我可以使用相同的URL,但可以使用不同的动态细分吗?

无法使用file_get_contents()获得数组值,但可以使用本地文件

Angular and Stripe,无法使用$ http创建Card令牌,但可以使用CURL

DNS无法解析,但可以使用FQDN ping和使用nslookup吗?

无法使用xcodebuild构建项目,但可以使用Xcode.app

为什么我无法加载早上生成的 excel 文件,但可以使用 Openpyxl 在 Python 中加载它们

Python opencv videocapture 无法使用 python3 打开文件,但可以使用 python2

为什么我无法使用 CreateFile Win32 API 打开文件 RW,但可以使用 std::remove 将其删除?

我无法在构建中使用 ifstream 读取文件,但可以在 IDE 中读取它

无法使用 Visual Studio 访问 Azure SQL 数据库,但可以使用 SSMS