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

时间:2016-01-05 15:24:53

标签: 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/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/osboxes/Desktop/ConteudosServer/backupsystem/backups/Fri_11_Dec_21.18.14_i_2015 user_backup@192.168.141.131:/home/user_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

0 个答案:

没有答案
相关问题