Anzeige:
Ergebnis 1 bis 12 von 12

Thema: Ubuntu lässt SFTP Port 22 zu aber kein FTP Port 20/21

  1. #1
    Registrierter Benutzer
    Registriert seit
    Apr 2020
    Beiträge
    56

    Ubuntu lässt SFTP Port 22 zu aber kein FTP Port 20/21

    Hallo,

    ich habe vsftpd auf einer VM (ESXi 6.5) Ubuntu 20.04.2 LTS installiert. Via Filezilla komme ich dort mit sftp und Port 22 ganz normal auf den entsprechenden FTP-Ordner mit Username und Passwort. Allerdings bekomme ich mit FTP und Port 20/21 immer "Verbindungsversuch fehlgeschlagen mit "ECONNREFUSED - Verbindung durch Server verweigert"."

    ufw status auf der dem Ubuntu:

    Code:
    To                         Action      From
    --                         ------      ----
    22/tcp                     ALLOW       Anywhere
    22                         ALLOW       Anywhere
    21                         ALLOW       Anywhere
    20                         ALLOW       Anywhere
    21/tcp                     ALLOW       Anywhere
    990/tcp                    ALLOW       Anywhere
    40000:50000/tcp            ALLOW       Anywhere
    22/tcp (v6)                ALLOW       Anywhere (v6)
    22 (v6)                    ALLOW       Anywhere (v6)
    21 (v6)                    ALLOW       Anywhere (v6)
    20 (v6)                    ALLOW       Anywhere (v6)
    21/tcp (v6)                ALLOW       Anywhere (v6)
    990/tcp (v6)               ALLOW       Anywhere (v6)
    40000:50000/tcp (v6)       ALLOW       Anywhere (v6)
    die vsftpd.conf:

    Code:
    # Example config file /etc/vsftpd.conf
    #
    # The default compiled in settings are fairly paranoid. This sample file
    # loosens things up a bit, to make the ftp daemon more usable.
    # Please see vsftpd.conf.5 for all compiled in defaults.
    #
    # READ THIS: This example file is NOT an exhaustive list of vsftpd options.
    # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
    # capabilities.
    #
    #
    # Run standalone?  vsftpd can run either from an inetd or as a standalone
    # daemon started from an initscript.
    listen=NO
    #
    # This directive enables listening on IPv6 sockets. By default, listening
    # on the IPv6 "any" address (::) will accept connections from both IPv6
    # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
    # sockets. If you want that (perhaps because you want to listen on specific
    # addresses) then you must run two copies of vsftpd with two configuration
    # files.
    listen_ipv6=YES
    #
    # Allow anonymous FTP? (Disabled by default).
    anonymous_enable=NO
    #
    # Uncomment this to allow local users to log in.
    local_enable=YES
    #
    # Uncomment this to enable any form of FTP write command.
    write_enable=YES
    #
    # Default umask for local users is 077. You may wish to change this to 022,
    # if your users expect that (022 is used by most other ftpd's)
    #local_umask=022
    #
    # Uncomment this to allow the anonymous FTP user to upload files. This only
    # has an effect if the above global write enable is activated. Also, you will
    # obviously need to create a directory writable by the FTP user.
    #anon_upload_enable=YES
    #
    # Uncomment this if you want the anonymous FTP user to be able to create
    # new directories.
    #anon_mkdir_write_enable=YES
    #
    # Activate directory messages - messages given to remote users when they
    # go into a certain directory.
    dirmessage_enable=YES
    #
    # If enabled, vsftpd will display directory listings with the time
    # in  your  local  time  zone.  The default is to display GMT. The
    # times returned by the MDTM FTP command are also affected by this
    # option.
    use_localtime=YES
    #
    # Activate logging of uploads/downloads.
    xferlog_enable=YES
    #
    # Make sure PORT transfer connections originate from port 20 (ftp-data).
    connect_from_port_20=YES
    #
    # If you want, you can arrange for uploaded anonymous files to be owned by
    # a different user. Note! Using "root" for uploaded files is not
    # recommended!
    #chown_uploads=YES
    #chown_username=whoever
    #
    # You may override where the log file goes if you like. The default is shown
    # below.
    #xferlog_file=/var/log/vsftpd.log
    #
    # If you want, you can have your log file in standard ftpd xferlog format.
    # Note that the default log file location is /var/log/xferlog in this case.
    #xferlog_std_format=YES
    #
    # You may change the default value for timing out an idle session.
    #idle_session_timeout=600
    #
    # You may change the default value for timing out a data connection.
    #data_connection_timeout=120
    #
    # It is recommended that you define on your system a unique user which the
    # ftp server can use as a totally isolated and unprivileged user.
    #nopriv_user=ftpsecure
    #
    # Enable this and the server will recognise asynchronous ABOR requests. Not
    # recommended for security (the code is non-trivial). Not enabling it,
    # however, may confuse older FTP clients.
    #async_abor_enable=YES
    #
    # By default the server will pretend to allow ASCII mode but in fact ignore
    # the request. Turn on the below options to have the server actually do ASCII
    # mangling on files when in ASCII mode.
    # Beware that on some FTP servers, ASCII support allows a denial of service
    # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
    # predicted this attack and has always been safe, reporting the size of the
    # raw file.
    # ASCII mangling is a horrible feature of the protocol.
    #ascii_upload_enable=YES
    #ascii_download_enable=YES
    #
    # You may fully customise the login banner string:
    #ftpd_banner=Welcome to blah FTP service.
    #
    # You may specify a file of disallowed anonymous e-mail addresses. Apparently
    # useful for combatting certain DoS attacks.
    #deny_email_enable=YES
    # (default follows)
    #banned_email_file=/etc/vsftpd.banned_emails
    #
    # You may restrict local users to their home directories.  See the FAQ for
    # the possible risks in this before using chroot_local_user or
    # chroot_list_enable below.
    #chroot_local_user=YES
    #
    # You may specify an explicit list of local users to chroot() to their home
    # directory. If chroot_local_user is YES, then this list becomes a list of
    # users to NOT chroot().
    # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
    # the user does not have write access to the top level directory within the
    # chroot)
    chroot_local_user=YES
    #chroot_list_enable=YES
    # (default follows)
    #chroot_list_file=/etc/vsftpd.chroot_list
    #
    # You may activate the "-R" option to the builtin ls. This is disabled by
    # default to avoid remote users being able to cause excessive I/O on large
    # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
    # the presence of the "-R" option, so there is a strong case for enabling it.
    #ls_recurse_enable=YES
    #
    # Customization
    #
    # Some of vsftpd's settings don't fit the filesystem layout by
    # default.
    #
    # This option should be the name of a directory which is empty.  Also, the
    # directory should not be writable by the ftp user. This directory is used
    # as a secure chroot() jail at times vsftpd does not require filesystem
    # access.
    secure_chroot_dir=/var/run/vsftpd/empty
    #
    # This string is the name of the PAM service vsftpd will use.
    pam_service_name=vsftpd
    #
    # This option specifies the location of the RSA certificate to use for SSL
    # encrypted connections.
    rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    ssl_enable=NO
    
    #
    # Uncomment this to indicate that vsftpd use a utf8 filesystem.
    #utf8_filesystem=YES
    
    user_sub_token=$USER
    local_root=/home/$USER/ftp
    
    userlist_enable=YES
    userlist_file=/etc/vsftpd.userlist
    userlist_deny=NO

    Was mache ich also falsch?

    LG
    Geändert von linuxbert (06.09.21 um 10:59 Uhr)

  2. #2
    kleine schwester von root Avatar von corresponder
    Registriert seit
    May 2002
    Ort
    192.67.198.56
    Beiträge
    4.578
    Code:
    ps faxuww |grep ftp
    - gucken ob der Dienst läuft

    Code:
    netstat -an |grep LISTEN
    - gucken ob der Port lauscht
    _______________________________________

    www.audio4linux.de - musik machen mit offenen quellen!

  3. #3
    Registrierter Benutzer
    Registriert seit
    Apr 2020
    Beiträge
    56
    ps faxuww |grep ftp

    Code:
    root      478946  0.0  0.0   5192   672 pts/0    S+   09:17   0:00  |                   \_ grep --color=auto ftp
    ftpuser   476304  0.0  0.1   5884  4228 ?        Ss   07:37   0:00  |       \_ /usr/lib/openssh/sftp-server
    ftpuser   476966  0.0  0.1   5884  4504 ?        Ss   08:00   0:00  |       \_ /usr/lib/openssh/sftp-server
    ftpuser   477798  0.0  0.1   5884  4268 ?        Ss   08:29   0:00          \_ /usr/lib/openssh/sftp-server
    netstat -an |grep LISTEN

    Code:
    tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN
    tcp6       0      0 :::22                   :::*                    LISTEN
    tcp6       0      0 ::1:6010                :::*                    LISTEN
    unix  2      [ ACC ]     SEQPACKET  LISTENING     17173    /run/udev/control
    unix  2      [ ACC ]     STREAM     LISTENING     1196597  /run/user/1000/systemd/private
    unix  2      [ ACC ]     STREAM     LISTENING     1196602  /run/user/1000/bus
    unix  2      [ ACC ]     STREAM     LISTENING     1196603  /run/user/1000/gnupg/S.dirmngr
    unix  2      [ ACC ]     STREAM     LISTENING     1196605  /run/user/1000/gnupg/S.gpg-agent.browser
    unix  2      [ ACC ]     STREAM     LISTENING     1196606  /run/user/1000/gnupg/S.gpg-agent.extra
    unix  2      [ ACC ]     STREAM     LISTENING     17157    @/org/kernel/linux/storage/multipathd
    unix  2      [ ACC ]     STREAM     LISTENING     1196607  /run/user/1000/gnupg/S.gpg-agent.ssh
    unix  2      [ ACC ]     STREAM     LISTENING     22291    /var/snap/lxd/common/lxd/unix.socket
    unix  2      [ ACC ]     STREAM     LISTENING     1196608  /run/user/1000/gnupg/S.gpg-agent
    unix  2      [ ACC ]     STREAM     LISTENING     1196609  /run/user/1000/pk-debconf-socket
    unix  2      [ ACC ]     STREAM     LISTENING     1196610  /run/user/1000/snapd-session-agent.socket
    unix  2      [ ACC ]     STREAM     LISTENING     17144    /run/systemd/private
    unix  2      [ ACC ]     STREAM     LISTENING     17146    /run/systemd/userdb/io.systemd.DynamicUser
    unix  2      [ ACC ]     STREAM     LISTENING     17155    /run/lvm/lvmpolld.socket
    unix  2      [ ACC ]     STREAM     LISTENING     17168    /run/systemd/journal/stdout
    unix  2      [ ACC ]     STREAM     LISTENING     16279    /run/systemd/journal/io.systemd.journal
    unix  2      [ ACC ]     STREAM     LISTENING     21411    /var/run/vmware/guestServicePipe
    unix  2      [ ACC ]     STREAM     LISTENING     22283    /run/dbus/system_bus_socket
    unix  2      [ ACC ]     STREAM     LISTENING     22293    /run/snapd.socket
    unix  2      [ ACC ]     STREAM     LISTENING     22295    /run/snapd-snap.socket
    unix  2      [ ACC ]     STREAM     LISTENING     22297    /run/uuidd/request
    unix  2      [ ACC ]     STREAM     LISTENING     23170    /run/irqbalance//irqbalance892.sock
    unix  2      [ ACC ]     STREAM     LISTENING     22290    @ISCSIADM_ABSTRACT_NAMESPACE

  4. #4
    Registrierter Benutzer
    Registriert seit
    Apr 2009
    Ort
    Erde
    Beiträge
    2.814
    [edit] nicht sinnvollen text entfernt
    Gruß nopes
    (,,,)---(^.^)---(,,,) /var/log/messages | grep cat

  5. #5
    Registrierter Benutzer Avatar von Huhn Hur Tu
    Registriert seit
    Nov 2003
    Ort
    Karlsruhe
    Beiträge
    2.243
    Auf Port 21 lauscht nichts, es laeuft also kein FTP Server, das ist der Grund fuer das Connection Refused. Warum willst du per FTP auf eine Maschine die SFTP aka. scp aka. copy over ssh am laufen hat.
    Zwischen anonym sein wollen und seine Daten nicht verkaufen wollen, liegen zwei Welten. Wenn man sich einen kostenpflichtigen Dienst sucht, dann meist, weil man für diese Dienstleistung zahlt und nicht selbst das Produkt sein will.


  6. #6
    Registrierter Benutzer
    Registriert seit
    Apr 2020
    Beiträge
    56
    Zitat Zitat von Huhn Hur Tu Beitrag anzeigen
    Auf Port 21 lauscht nichts, es laeuft also kein FTP Server, das ist der Grund fuer das Connection Refused. Warum willst du per FTP auf eine Maschine die SFTP aka. scp aka. copy over ssh am laufen hat.
    Die VM muss mit einem Uralt-Client kommunizieren, der nur FTP kann und explizit kein SFTP. Nun ist die Frage, warum FTP nicht läuft.

  7. #7
    Registrierter Benutzer
    Registriert seit
    Apr 2020
    Beiträge
    56
    service vsftpd status

    Code:
    ● vsftpd.service - vsftpd FTP server
         Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabl>
         Active: failed (Result: exit-code) since Mon 2021-09-06 12:53:16 UTC; 1s ago
        Process: 484845 ExecStartPre=/bin/mkdir -p /var/run/vsftpd/empty (code=exited, sta>
        Process: 484846 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf (code=exited, status=2)
       Main PID: 484846 (code=exited, status=2)
    
    Sep 06 12:53:16 msrftp systemd[1]: Starting vsftpd FTP server...
    Sep 06 12:53:16 msrftp systemd[1]: Started vsftpd FTP server.
    Sep 06 12:53:16 msrftp systemd[1]: vsftpd.service: Main process exited, code=exited, s>
    Sep 06 12:53:16 msrftp systemd[1]: vsftpd.service: Failed with result 'exit-code'.


    hmm ...

  8. #8
    kleine schwester von root Avatar von corresponder
    Registriert seit
    May 2002
    Ort
    192.67.198.56
    Beiträge
    4.578
    Active: failed
    er startet nicht...
    _______________________________________

    www.audio4linux.de - musik machen mit offenen quellen!

  9. #9
    Registrierter Benutzer
    Registriert seit
    Apr 2020
    Beiträge
    56
    Zitat Zitat von corresponder Beitrag anzeigen
    er startet nicht...
    Jetzt geht er. Ich hatte eine Zeile doppelt. Verbindung ist trotzdem nicht möglich. Über Port 21 kommt folgender Text in Filezilla:


    Code:
    Verbinde mit 10.0.0.88:21...
    11:29:49	Status:	Verbindung hergestellt, warte auf Willkommensnachricht...
    11:29:50	Status:	Unsicherer Server; er unterstützt kein FTP über TLS.
    11:29:50	Status:	Der Server unterstützt keine Nicht-ASCII-Zeichen.
    11:29:50	Status:	Angemeldet
    11:29:50	Status:	Empfange Verzeichnisinhalt...
    11:29:30	Befehl:	PWD
    11:29:30	Antwort:	257 "/home/ftpuser" is the current directory
    11:29:49	Befehl:	TYPE I
    11:29:49	Antwort:	200 Switching to Binary mode.
    11:29:49	Befehl:	PASV
    11:29:49	Antwort:	227 Entering Passive Mode (10,0,0,88,48,142).
    11:29:49	Befehl:	LIST
    11:30:09	Fehler:	Zeitüberschreitung der Verbindung nach 20 Sekunden Inaktivität
    11:30:09	Fehler:	Verzeichnisinhalt konnte nicht empfangen werden
    11:29:50	Befehl:	PWD
    11:29:50	Antwort:	257 "/home/ftpuser" is the current directory
    11:30:09	Befehl:	TYPE I
    11:30:09	Antwort:	200 Switching to Binary mode.
    11:30:09	Befehl:	PASV
    11:30:10	Antwort:	227 Entering Passive Mode (10,0,0,88,59,178).
    11:30:10	Befehl:	LIST
    11:30:30	Fehler:	Zeitüberschreitung der Verbindung nach 20 Sekunden Inaktivität
    11:30:30	Fehler:	Verzeichnisinhalt konnte nicht empfangen werden
    Geändert von linuxbert (07.09.21 um 11:40 Uhr)

  10. #10
    Registrierter Benutzer
    Registriert seit
    Apr 2020
    Beiträge
    56
    Kann es sein, dass ESXi irgendwas blockiert?

  11. #11
    Registrierter Benutzer
    Registriert seit
    Jun 2004
    Beiträge
    1.423
    Eher ufw.

    "Entering passive mode" - Server versucht, mit dem Client höhere Ports als 20/21 auszuhandeln.

    Schalte mal zum Test in Filezilla in den Session-Einstellungen den passiven Modus ab, dann sollte man
    im Log zur Session kein "PASV"-cmd mehr sehen.
    Damit verbindet sich der Client mit dem Server nur via Port 20/21.

  12. #12
    Registrierter Benutzer
    Registriert seit
    Apr 2020
    Beiträge
    56
    Zitat Zitat von temir Beitrag anzeigen
    Eher ufw.

    "Entering passive mode" - Server versucht, mit dem Client höhere Ports als 20/21 auszuhandeln.

    Schalte mal zum Test in Filezilla in den Session-Einstellungen den passiven Modus ab, dann sollte man
    im Log zur Session kein "PASV"-cmd mehr sehen.
    Damit verbindet sich der Client mit dem Server nur via Port 20/21.
    Das war es! Vielen Dank!

Ähnliche Themen

  1. Kann der WAN/Internet-Port/Uplink-Port von Hardware-Routern dhcp?
    Von E.coli im Forum Router und Netzaufbau
    Antworten: 2
    Letzter Beitrag: 17.04.09, 17:27
  2. SuSE Firewall Port öffnen / Port weiterleiten / Port testen
    Von stopsy im Forum Router und Netzaufbau
    Antworten: 3
    Letzter Beitrag: 12.02.08, 19:17
  3. SFTP-Client mit GUI? (nicht Port 22)
    Von backflip im Forum Linux als Server
    Antworten: 8
    Letzter Beitrag: 04.08.07, 01:31
  4. Port-Forwarding geht, aber nicht auf anderen Port
    Von fesek im Forum Router und Netzaufbau
    Antworten: 6
    Letzter Beitrag: 28.03.04, 23:56
  5. kein zugriff auf port 110 aber wohl auf 25 warum?
    Von momo im Forum Linux als Server
    Antworten: 1
    Letzter Beitrag: 17.04.01, 10:30

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •