FTP FTP Libaries

Diskutiere FTP Libaries im Netzwerkprogrammierung Bereich.
X

Xyz1

Ein 'vergleichbare' Frage gab es hier schonmal....

Bearbeitung wiedergefunden, allerdings kein 'kskkb' dabei.
 
Zuletzt bearbeitet von einem Moderator:
F

FawKes100

Hab den Fehler nun endlich gefunden, in irgendner Methode wurde noch die alte FTP-Verbindung versucht aufzubauen - die Klasse hab ich nun komplett gelöscht, sodass es jetzt fehlerfrei funktioniert. Danke schön für die Hilfe!
 
F

FawKes100

Habe heute plötzlich folgenden Error bekommen, ohne dass ich den Upload-Code groß artig verändert habe...
Hier nun einmal daher trotzdem noch der Code:

Java:
import com.jcraft.jsch.*;

import java.util.Properties;

public class Uploader
{
    private Session session;
    private Channel channel;
    private JSch jsch;

    public ChannelSftp connect(String host, int port, String user, String pwd, int timeout)
    {
        this.jsch = new JSch();
        Properties config = new Properties();
        config.put("StrictHostKeyChecking", "no");
        jsch.setConfig(config);

        try
        {
            session = jsch.getSession(user, host, port);
            session.setPassword(pwd);
            session.connect(timeout);

            Channel channel = session.openChannel("sftp");
            channel.connect();
            return (ChannelSftp) channel;
        } catch (JSchException e) {
            e.printStackTrace();
        }
        return null;
    }

    public void upload(String remotePath, String serverPath, ChannelSftp channelSftp)
    {
        if(channelSftp == null || session== null)
        {
            connect("212.114.61.233", 22, "xxx", "xxx", 500);
        }

        try {
            channelSftp.put(remotePath, serverPath);
        } catch (SftpException e) {
            e.printStackTrace();
        }
    }

    public void disconnect(ChannelSftp channelSftp)
    {
        channelSftp.exit();
        session.disconnect();
    }
}
Als Fehlermeldung erhalte ich folgende:

Code:
4: Failure
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
    at com.jcraft.jsch.ChannelSftp._put(ChannelSftp.java:594)
    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:475)
    at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:365)
    at Uploader.upload(Uploader.java:41)
    at Ark.run(Ark.java:49)
    at Main.createMods(Main.java:32)
    at Main.<init>(Main.java:19)
    at Main.main(Main.java:131)
Hat jemand ne Idee, was die Ursache dieses Fehlers ist? Ich habe bereits gegoogelt und herausgefunden, dass es möglicherweise eine volle Festplatte sein könnte, aber laut dem Serverhoster sind noch mehr als 3 GB frei.
 
Zuletzt bearbeitet von einem Moderator:
looparda

looparda

Ähm.. da stehen die Logindaten für den SSH Zugang auf den Server. OK?
 
F

FawKes100

Oh, das mit den Zugangsdaten zum Server ist mir gar nicht aufgefallen, hab das Passwort aber nu geändert. Was mich nur wundert ist, dass es gestern mitnahezu dem selben Code noch funktioniert hatte... Demnach müsste der Fehler doch irgendwo im Code stecken oder?
 
F

FawKes100

Was meinst du genau für Logs?
Ich versuche hier mit dem Code auf einen Server in einem Rechenzentrum zu verbinden, dieser läuft mit Debian 9...
Falls die Rede von irgendwelchen Server logs ist, so hab ich keine Ahnung wo ich die finde.

was genau meinst du mit:
?

Ich habe es jetzt nochmal genauer überprüft, der Fehler tritt nicht auf, wenn die Verbindung hergestellt wird, sondern wenn versucht wird eine Datei hochzuladen..
Was ich verwirrend finde: Es gibt einmal einen ChannelSFTP und einen normalen Channel. Benutze ich evtl den falschen zum hochladen?
 
Zuletzt bearbeitet:
X

Xyz1

last -n 100 und (sudo) tail /var/log/auth.log -n 100 | grep -i "port\|ssh2\|accepted" und (sudo) grep -i "dpt=22" /var/log/syslog wäre ein Anfang

was genau meinst du mit:
es bringt doch nüschts, connect aufzurufen wenn dessen Rückgabe dann nicht einer Variable n zugeordnet wird

aber vielleicht nur ein unwichtiges Detail
 
F

FawKes100

Hab den Rückgabetyp wieder zurück geändert zu ner normalen void funktion. Das Problem ist allerdings immer noch nicht behoben. ChannelSFTP und Channel habe ich jetzt als Klassennamen gespeichert - brachte aber keinen Unterschied.

last -n 100 ergibt folgende Ergebnisse:
root pts/2 93.245.25.192 Wed Aug 29 19:21 still logged in
root pts/2 93.245.25.192 Wed Aug 29 16:09 - 19:21 (03:12)
root pts/2 93.245.25.192 Wed Aug 29 14:14 - 14:18 (00:03)
reboot system boot 4.15.17-2-pve Wed Aug 29 14:14 still running
root pts/2 93.245.25.192 Tue Aug 28 18:47 - down (19:26)
root pts/2 93.245.25.192 Tue Aug 28 13:50 - 18:47 (04:57)
root pts/2 93.245.25.192 Sun Aug 26 18:57 - 13:50 (1+18:53)
reboot system boot 4.15.17-2-pve Sun Aug 26 18:56 - 14:14 (2+19:17)
root pts/2 93.245.25.192 Sun Aug 26 12:30 - down (06:26)
reboot system boot 4.15.17-2-pve Sun Aug 26 12:30 - 18:56 (06:26)
root pts/2 93.245.25.192 Sun Aug 26 12:28 - down (00:01)
reboot system boot 4.15.17-2-pve Sun Aug 26 12:22 - 12:30 (00:07)
root pts/2 93.245.25.192 Sun Aug 26 11:52 - down (00:29)
root pts/2 93.245.25.192 Sun Aug 26 11:33 - 11:44 (00:11)
reboot system boot 4.15.17-2-pve Sun Aug 26 11:29 - 12:22 (00:52)
root pts/2 93.245.25.192 Sat Aug 25 14:18 - 15:45 (01:27)
root pts/2 93.245.25.192 Thu Aug 23 09:18 - 14:18 (2+04:59)
root pts/2 93.245.25.192 Wed Aug 22 18:47 - 09:18 (14:31)
reboot system boot 4.15.17-2-pve Wed Aug 22 18:46 - 11:29 (3+16:42)
root pts/2 93.245.25.192 Wed Aug 22 18:42 - down (00:03)
reboot system boot 4.15.17-2-pve Wed Aug 22 18:42 - 18:46 (00:04)
reboot system boot 4.15.17-2-pve Wed Aug 22 18:41 - 18:42 (00:00)
root pts/2 93.245.25.192 Tue Aug 21 20:14 - 00:09 (03:55)
root pts/2 93.245.25.192 Tue Aug 21 20:09 - 20:14 (00:05)
reboot system boot 4.15.17-2-pve Tue Aug 21 20:09 - 18:41 (22:32)
root pts/2 93.245.25.192 Sun Aug 19 00:00 - down (2+20:08)
reboot system boot 4.15.17-2-pve Sat Aug 18 23:59 - 20:09 (2+20:09)
root pts/2 93.245.25.192 Sat Aug 18 19:56 - down (04:02)
root pts/2 93.245.25.192 Sat Aug 18 19:28 - 19:56 (00:28)
root pts/2 93.245.25.192 Sat Aug 18 19:09 - 19:28 (00:18)
reboot system boot 4.15.17-2-pve Sat Aug 18 19:09 - 23:59 (04:50)
root pts/2 93.245.25.192 Sat Aug 18 19:03 - down (00:05)
root pts/2 217.232.75.137 Wed Aug 15 19:38 - 19:03 (2+23:24)
root pts/2 217.232.75.137 Wed Aug 15 19:36 - 19:37 (00:00)
root pts/2 217.232.75.137 Wed Aug 15 19:31 - 19:35 (00:04)
root pts/2 217.232.75.137 Tue Aug 14 21:30 - 23:44 (02:13)
reboot system boot 4.15.17-2-pve Tue Aug 14 21:27 - 19:08 (3+21:40)
root pts/2 217.232.75.137 Sat Aug 11 21:33 - 21:34 (00:00)
root pts/2 217.232.75.137 Sat Aug 11 14:13 - 21:33 (07:20)
reboot system boot 4.15.17-2-pve Sat Aug 11 14:12 - 19:08 (7+04:56)
root pts/2 217.232.75.137 Sat Aug 11 11:30 - down (02:42)
reboot system boot 4.15.17-2-pve Sat Aug 11 11:29 - 14:12 (02:43)
root pts/2 217.232.75.137 Fri Aug 10 21:57 - 00:10 (02:12)
reboot system boot 4.15.17-2-pve Fri Aug 10 21:57 - 11:29 (13:31)
root pts/2 217.232.75.137 Fri Aug 10 21:56 - down (00:00)
reboot system boot 4.15.17-2-pve Fri Aug 10 21:56 - 21:57 (00:00)
root pts/2 217.232.75.137 Fri Aug 10 21:51 - down (00:04)
root pts/2 217.232.75.137 Fri Aug 10 21:18 - 21:49 (00:31)
reboot system boot 4.15.17-2-pve Fri Aug 10 21:18 - 21:56 (00:38)
root pts/2 217.232.75.137 Fri Aug 10 19:47 - down (01:30)
reboot system boot 4.15.17-2-pve Fri Aug 10 19:47 - 21:17 (01:30)
root pts/2 93.193.180.37 Thu Aug 9 17:11 - down (1+02:35)
root pts/2 93.193.180.37 Thu Aug 9 17:10 - 17:11 (00:00)
root pts/2 93.193.180.37 Thu Aug 9 17:08 - 17:10 (00:01)
root pts/2 93.193.180.37 Thu Aug 9 15:12 - 17:08 (01:55)
reboot system boot 4.15.17-2-pve Thu Aug 9 15:12 - 19:47 (1+04:34)
root pts/2 93.193.180.37 Thu Aug 9 15:11 - down (00:00)
reboot system boot 4.15.17-2-pve Thu Aug 9 15:11 - 15:12 (00:00)
root pts/2 93.193.180.37 Thu Aug 9 14:55 - down (00:16)
reboot system boot 4.15.17-2-pve Thu Aug 9 14:55 - 15:11 (00:16)
root pts/2 93.193.180.37 Thu Aug 9 13:45 - down (01:09)
reboot system boot 4.15.17-2-pve Thu Aug 9 13:44 - 14:54 (01:10)
root pts/2 93.193.180.37 Thu Aug 9 11:19 - down (02:25)
reboot system boot 4.15.17-2-pve Thu Aug 9 11:18 - 13:44 (02:26)
root pts/2 93.193.180.37 Thu Aug 9 10:38 - down (00:39)
root pts/2 93.193.180.37 Thu Aug 9 10:38 - 10:38 (00:00)
reboot system boot 4.15.17-2-pve Thu Aug 9 10:38 - 11:18 (00:39)
root pts/2 93.193.180.37 Thu Aug 9 10:37 - down (00:00)
root pts/2 93.193.180.37 Thu Aug 9 10:36 - 10:37 (00:01)
root pts/2 93.193.180.37 Wed Aug 8 22:38 - 22:39 (00:01)
root pts/2 93.193.184.158 Tue Aug 7 19:16 - 22:38 (1+03:21)
reboot system boot 4.15.17-2-pve Tue Aug 7 19:16 - 10:38 (1+15:21)
root pts/2 93.193.184.158 Tue Aug 7 18:33 - down (00:42)
reboot system boot 4.15.17-2-pve Tue Aug 7 18:33 - 19:16 (00:43)
root pts/2 217.232.66.102 Mon Aug 6 22:07 - down (20:26)
reboot system boot 4.15.17-2-pve Mon Aug 6 22:07 - 18:33 (20:26)
root pts/2 217.232.66.102 Mon Aug 6 22:06 - down (00:00)
reboot system boot 4.15.17-2-pve Mon Aug 6 22:06 - 22:07 (00:00)
root pts/2 217.232.66.102 Mon Aug 6 22:05 - down (00:01)
reboot system boot 4.15.17-2-pve Mon Aug 6 22:03 - 22:06 (00:02)
root pts/2 93.244.237.215 Fri Aug 3 19:16 - 05:32 (10:16)
reboot system boot 4.15.17-2-pve Fri Aug 3 19:15 - 22:03 (3+02:47)
root pts/2 93.244.237.215 Fri Aug 3 10:13 - 14:17 (04:04)
reboot system boot 4.15.17-2-pve Fri Aug 3 10:12 - 19:15 (09:03)
root pts/2 93.244.237.215 Fri Aug 3 10:05 - down (00:07)
reboot system boot 4.15.17-2-pve Fri Aug 3 10:04 - 10:12 (00:07)
root pts/2 93.244.237.215 Thu Aug 2 18:49 - 18:49 (00:00)
root pts/2 93.244.237.215 Wed Aug 1 21:40 - 23:58 (02:17)
reboot system boot 4.15.17-2-pve Wed Aug 1 21:40 - 10:04 (1+12:24)
root pts/2 93.244.237.215 Wed Aug 1 09:11 - 09:11 (00:00)

wtmp begins Wed Aug 1 09:11:32 2018

tail /var/log/auth.log -n 100 | grep -i "port\|ssh2\|accepted" ergibt folgendes:
Aug 29 19:22:04 v1269 sshd[5491]: Failed password for root from 58.218.92.35 port 22372 ssh2
Aug 29 19:22:06 v1269 sshd[5497]: Failed password for invalid user ashton from 27.34.243.206 port 23846 ssh2
Aug 29 19:22:06 v1269 sshd[5497]: Connection closed by 27.34.243.206 port 23846 [preauth]
Aug 29 19:22:08 v1269 sshd[5491]: Failed password for root from 58.218.92.35 port 22372 ssh2
Aug 29 19:22:11 v1269 sshd[5491]: Failed password for root from 58.218.92.35 port 22372 ssh2
Aug 29 19:22:11 v1269 sshd[5491]: error: maximum authentication attempts exceeded for root from 58.218.92.35 port 22372 ssh2 [preauth]
Aug 29 19:22:16 v1269 sshd[5500]: Failed password for root from 58.218.92.35 port 7318 ssh2
Aug 29 19:22:20 v1269 sshd[5500]: Failed password for root from 58.218.92.35 port 7318 ssh2
Aug 29 19:22:23 v1269 sshd[5500]: Failed password for root from 58.218.92.35 port 7318 ssh2
Aug 29 19:22:25 v1269 sshd[5500]: Failed password for root from 58.218.92.35 port 7318 ssh2
Aug 29 19:22:28 v1269 sshd[5500]: Failed password for root from 58.218.92.35 port 7318 ssh2
Aug 29 19:22:31 v1269 sshd[5500]: Failed password for root from 58.218.92.35 port 7318 ssh2
Aug 29 19:22:31 v1269 sshd[5500]: error: maximum authentication attempts exceeded for root from 58.218.92.35 port 7318 ssh2 [preauth]
Aug 29 19:22:36 v1269 sshd[5502]: Failed password for root from 58.218.92.35 port 57602 ssh2
Aug 29 19:22:39 v1269 sshd[5502]: Failed password for root from 58.218.92.35 port 57602 ssh2
Aug 29 19:22:42 v1269 sshd[5502]: Failed password for root from 58.218.92.35 port 57602 ssh2
Aug 29 19:22:46 v1269 sshd[5502]: Failed password for root from 58.218.92.35 port 57602 ssh2
Aug 29 19:22:48 v1269 sshd[5502]: Failed password for root from 58.218.92.35 port 57602 ssh2
Aug 29 19:22:51 v1269 sshd[5502]: Failed password for root from 58.218.92.35 port 57602 ssh2
Aug 29 19:22:51 v1269 sshd[5502]: error: maximum authentication attempts exceeded for root from 58.218.92.35 port 57602 ssh2 [preauth]
Aug 29 19:22:57 v1269 sshd[5505]: Failed password for root from 58.218.92.35 port 44456 ssh2
Aug 29 19:22:59 v1269 sshd[5505]: Failed password for root from 58.218.92.35 port 44456 ssh2
Aug 29 19:23:02 v1269 sshd[5507]: Invalid user cvsadmin from 119.29.152.124 port 46707
Aug 29 19:23:02 v1269 sshd[5505]: Failed password for root from 58.218.92.35 port 44456 ssh2
Aug 29 19:23:04 v1269 sshd[5507]: Failed password for invalid user cvsadmin from 119.29.152.124 port 46707 ssh2
Aug 29 19:23:04 v1269 sshd[5507]: Connection closed by 119.29.152.124 port 46707 [preauth]
Aug 29 19:23:04 v1269 sshd[5505]: Failed password for root from 58.218.92.35 port 44456 ssh2
Aug 29 19:23:07 v1269 sshd[5505]: Failed password for root from 58.218.92.35 port 44456 ssh2
Aug 29 19:23:10 v1269 sshd[5505]: Failed password for root from 58.218.92.35 port 44456 ssh2
Aug 29 19:23:10 v1269 sshd[5505]: error: maximum authentication attempts exceeded for root from 58.218.92.35 port 44456 ssh2 [preauth]
Aug 29 19:23:15 v1269 sshd[5509]: Failed password for root from 58.218.92.35 port 26114 ssh2
Aug 29 19:23:18 v1269 sshd[5509]: Failed password for root from 58.218.92.35 port 26114 ssh2
Aug 29 19:23:20 v1269 sshd[5511]: Received disconnect from 116.31.116.4 port 58190:11: [preauth]
Aug 29 19:23:20 v1269 sshd[5511]: Disconnected from 116.31.116.4 port 58190 [preauth]
Aug 29 19:23:21 v1269 sshd[5509]: Failed password for root from 58.218.92.35 port 26114 ssh2
Aug 29 19:23:24 v1269 sshd[5509]: Failed password for root from 58.218.92.35 port 26114 ssh2
Aug 29 19:23:27 v1269 sshd[5509]: Failed password for root from 58.218.92.35 port 26114 ssh2
Aug 29 19:23:29 v1269 sshd[5509]: Failed password for root from 58.218.92.35 port 26114 ssh2
Aug 29 19:23:29 v1269 sshd[5509]: error: maximum authentication attempts exceeded for root from 58.218.92.35 port 26114 ssh2 [preauth]
Aug 29 19:23:34 v1269 sshd[5513]: Failed password for root from 58.218.92.35 port 9590 ssh2
Aug 29 19:23:36 v1269 sshd[5513]: Failed password for root from 58.218.92.35 port 9590 ssh2
Aug 29 19:23:40 v1269 sshd[5513]: Failed password for root from 58.218.92.35 port 9590 ssh2
Aug 29 19:23:41 v1269 sshd[5515]: Invalid user noroestenet from 121.35.255.126 port 48648
Aug 29 19:23:42 v1269 sshd[5513]: Failed password for root from 58.218.92.35 port 9590 ssh2
Aug 29 19:23:43 v1269 sshd[5515]: Failed password for invalid user noroestenet from 121.35.255.126 port 48648 ssh2
Aug 29 19:23:43 v1269 sshd[5515]: Connection closed by 121.35.255.126 port 48648 [preauth]
Aug 29 19:23:45 v1269 sshd[5513]: Failed password for root from 58.218.92.35 port 9590 ssh2
Aug 29 19:23:47 v1269 sshd[5513]: Failed password for root from 58.218.92.35 port 9590 ssh2
Aug 29 19:23:47 v1269 sshd[5513]: error: maximum authentication attempts exceeded for root from 58.218.92.35 port 9590 ssh2 [preauth]
Aug 29 19:23:52 v1269 sshd[5517]: Failed password for root from 58.218.92.35 port 53518 ssh2
Aug 29 19:23:54 v1269 sshd[5517]: Failed password for root from 58.218.92.35 port 53518 ssh2
Aug 29 19:23:57 v1269 sshd[5517]: Failed password for root from 58.218.92.35 port 53518 ssh2
Aug 29 19:24:00 v1269 sshd[5517]: Failed password for root from 58.218.92.35 port 53518 ssh2
Aug 29 19:24:03 v1269 sshd[5517]: Failed password for root from 58.218.92.35 port 53518 ssh2
Aug 29 19:24:07 v1269 sshd[5517]: Failed password for root from 58.218.92.35 port 53518 ssh2
Aug 29 19:24:07 v1269 sshd[5517]: error: maximum authentication attempts exceeded for root from 58.218.92.35 port 53518 ssh2 [preauth]
Aug 29 19:24:18 v1269 sshd[5520]: Failed password for root from 58.218.92.35 port 39836 ssh2
Aug 29 19:24:21 v1269 sshd[5520]: Failed password for root from 58.218.92.35 port 39836 ssh2
Aug 29 19:24:23 v1269 sshd[5520]: Failed password for root from 58.218.92.35 port 39836 ssh2
Aug 29 19:24:26 v1269 sshd[5520]: Failed password for root from 58.218.92.35 port 39836 ssh2
Aug 29 19:24:34 v1269 sshd[5520]: Received disconnect from 58.218.92.35 port 39836:11: [preauth]
Aug 29 19:24:34 v1269 sshd[5520]: Disconnected from 58.218.92.35 port 39836 [preauth]


grep -i "dpt=22" /var/log/syslog
Gibt er keine Ergebnisse raus, sondern wartet direkt auf die nächste Eingabe...
 
X

Xyz1

Ich schrieb doch nicht dass Du das hier schreiben sollst :(

suche mal nur nach accepted und für dich behalten :rolleyes:
 
F

FawKes100

Habe den Fehler nun gefunden, lag in der Logik in nem anderen Teil des Programmes. An dem ServerPath war am Ende immer noch nen Slash angehangen, sodass der Code jetzt wieder normal funktioniert :)
 
Thema: 

FTP Libaries

Passende Stellenanzeigen aus deiner Region:
Anzeige

Neue Themen

Anzeige

Anzeige
Oben