Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl Net::SCP SCP在test.pl第27行以非成功状态退出:256_Perl_Scp - Fatal编程技术网

Perl Net::SCP SCP在test.pl第27行以非成功状态退出:256

Perl Net::SCP SCP在test.pl第27行以非成功状态退出:256,perl,scp,Perl,Scp,我在互联网上搜索过这个错误代码。唯一剩下的地方就是你的人类思维 这是我的密码: #!/usr/bin/perl use strict; use Net::FTP; use Net::SCP; use Net::SCP::Expect; my $ip = "192.168.141.131"; my $username = "user_backup"; my $password = "ubuntu"; my $tfr_type = "scp"; my $file = "/home/osboxe

我在互联网上搜索过这个错误代码。唯一剩下的地方就是你的人类思维

这是我的密码:

#!/usr/bin/perl

use strict;

use Net::FTP;
use Net::SCP;
use Net::SCP::Expect;

my $ip = "192.168.141.131";
my $username = "user_backup";
my $password = "ubuntu";
my $tfr_type = "scp";
my $file = "/home/osboxes/Desktop/ConteudosServer/backupsystem/backups/Fri_11_Dec_21.18.14_i‌​_2015";
my $dest = "/home/user_backup/backups/aqui.txt";


my $scp = Net::SCP::Expect->new(
        host => $ip,
        user => $username,
        password => $password,
        auto_yes => 1,
        verbose => 1,
        debug => 1,
        timeout_auto => 1,
        );

$scp->scp($file, $dest);
print "Source: $file\n";
print "Desti: $dest\n";
我不知道哪里出了问题。它说第26行:
$scp->scp($file,$dest)
编辑
正如Kenster所建议的(谢谢兄弟),这里是
scp-v/home/osbox/Desktop/ConteudosServer/backupsystem/backups/Fri_11_Dec_21.18.14_i_2015用户_backup@192.168.141.131:/home/user\u backup/backups/aqui.txt>/tmp/rapid.txt
命令:

debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.141.131 [192.168.141.131] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64-etm@openssh.com none
debug1: kex: client->server aes128-ctr umac-64-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 30:af:e0:62:a2:cd:f9:e0:ae:43:2a:d8:b9:b3:e5:72

debug1: Host '192.168.141.131' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:2
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
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Next authentication method: password
user_backup@192.168.141.131's password: 
debug1: Authentication succeeded (password).
Authenticated to 192.168.141.131 ([192.168.141.131]: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 = en_GB.UTF-8
debug1: Sending command: scp -v -t /home/user_backup/backups/aqui.txt
Sending file modes: C0644 104540 Fri_11_Dec_21.18.14_i_2015
Sink: C0644 104540 Fri_11_Dec_21.18.14_i_2015
scp: /home/user_backup/backups/aqui.txt: Permission denied
root@osboxes:/home/osboxes/Desktop/ConteudosServer/backupsystem# 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 2636, received 2344 bytes, in 0.2 seconds
Bytes per second: sent 12676.0, received 11271.8
debug1: Exit status 1

尝试使用相同的主机名、用户名、密码和文件参数手动运行scp命令行实用程序。添加“-v”选项以使scp输出调试信息。然后编辑您的问题,以包括您运行的scp命令及其生成的输出。快速测试后,如果源文件的名称不正确,则会生成该错误,该文件不存在。我已经尝试了
scp-v/home/osbox/Desktop/conteudoserver/backupsystem/backups/Fri_11_Dec_21.18.14_I_2015用户_backup@192.168.141.131:/home/user\u backup/backups/aqui.txt
,它确实有效。O将每个参数复制到脚本中,但它仍然给我相同的错误。有没有办法不用密码就能做到这一点?类似于RSA密钥的东西。@ikegami,就是这样。谢谢你让我知道。
Net::SCP::Expect
的结构定义了其余部分<代码>$username=user\u backup
$ip=192.168.141.130
,等等。。。从我的角度来看,我测试的正是脚本将要做的。我错了吗?请尝试使用相同的主机名、用户名、密码和文件参数手动运行scp命令行实用程序。添加“-v”选项以使scp输出调试信息。然后编辑您的问题,以包括您运行的scp命令及其生成的输出。快速测试后,如果源文件的名称不正确,则会生成该错误,该文件不存在。我已经尝试了
scp-v/home/osbox/Desktop/conteudoserver/backupsystem/backups/Fri_11_Dec_21.18.14_I_2015用户_backup@192.168.141.131:/home/user\u backup/backups/aqui.txt
,它确实有效。O将每个参数复制到脚本中,但它仍然给我相同的错误。有没有办法不用密码就能做到这一点?类似于RSA密钥的东西。@ikegami,就是这样。谢谢你让我知道。
Net::SCP::Expect
的结构定义了其余部分<代码>$username=user\u backup,
$ip=192.168.141.130
,等等。。。从我的角度来看,我测试的正是脚本将要做的。我错了吗?