Ubuntu-Benutzer-FTP-Zugriff

1445
tadywankenobi

Ich hatte echte Probleme mit dem FTP-Zugriff auf meine Cloud-VPS-Ubuntu-Lösung.

Ich habe sowohl vsftpd als auch pure-ftpd ausprobiert. Ich fand, dass beide begrenzt waren. Ich habe jetzt versucht, mich auf vsftpd zu konzentrieren, da es gut angenommen wird.

Ich habe versucht, den Anweisungen hier zu folgen:

http://ubuntuforums.org/showthread.php?t=518293

Das einzige, was ich in diesem Handbuch bisher nicht getan habe, ist das Hinzufügen der TLS / SSL / FTPS-Regeln, da ich Probleme habe, den Port 990 zu den Firewall-Einstellungen des Servers hinzuzufügen. Dies wurde mit meinem Provider gekennzeichnet und wird hoffentlich rechtzeitig behoben.

Anfangs benutzte ich Benutzer mit Shell-Zugriff. Dies erlaubte dem Benutzer, sich anzumelden und auf den Server und die richtigen Ordner zuzugreifen, konnte jedoch keine neuen Dateien schreiben oder vorhandene Dateien auf dem Server überschreiben. Sie könnten Ordner erstellen und Dateien löschen. Wenn ich mich mit Shell-Konten mit der Befehlszeilen-FTP-Datenbank anmeldete, konnte ich (mput) -Dateien auf dem Server kein Problem schreiben, aber ich gehe davon aus, dass die Befehlszeilen-FTP-Funktion im Gegensatz zu einem FTP-Dienst funktioniert.

Ich dachte, mein Problem könnte sein, dass meine Benutzer möglicherweise nicht in der Lage sind, auf Shell zuzugreifen. Ich habe dann einen neuen Benutzer ohne Shellzugriff erstellt. Ich kann mich mit diesen Benutzern nicht anmelden. Ich bekomme eine falsche 530-Anmeldung, obwohl ich das Kennwort geändert und getestet habe. Ich kann mich auch nicht mit der Kommandozeile ftp anmelden.

Ich habe unten meine vsftpd.conf-Datei eingefügt. Ich habe eine eigene Version ausprobiert, aber am Ende auf das Original zurückgesetzt, um nochmal von vorne zu beginnen. Ich habe die Direktive check_shell = NO hinzugefügt, um zu sehen, ob dies geholfen hat. Ich hatte den Weg des Hinzufügens von virtuellen Benutzern zum System begonnen, aber ich sehe nicht, wie dies etwas ändern wird.

Ich habe buchstäblich das ganze Wochenende damit verbracht, dieses Problem zu lösen, jedoch ohne Erfolg.

Hier sind die / etc / shadow-Inhalte (-hashed pwds). Die zwei neuen Benutzer sind spdftp und scftp:

root:xxxx:15607:0:99999:7::: daemon:*:15104:0:99999:7::: bin:*:15104:0:99999:7::: sys:*:15104:0:99999:7::: sync:*:15104:0:99999:7::: games:*:15104:0:99999:7::: man:*:15104:0:99999:7::: lp:*:15104:0:99999:7::: mail:*:15104:0:99999:7::: news:*:15104:0:99999:7::: uucp:*:15104:0:99999:7::: proxy:*:15104:0:99999:7::: www-data:*:15104:0:99999:7::: backup:*:15104:0:99999:7::: list:*:15104:0:99999:7::: irc:*:15104:0:99999:7::: gnats:*:15104:0:99999:7::: nobody:*:15104:0:99999:7::: libuuid:!:15104:0:99999:7::: syslog:*:15104:0:99999:7::: sshd:*:15104:0:99999:7::: mysql:!:15104:0:99999:7::: postfix:*:15424:0:99999:7::: clamav:!:15425:0:99999:7::: amavis:*:15425:0:99999:7::: vmail:!:15425:0:99999:7::: dovecot:*:15425:0:99999:7::: vsftpd:!:15724:0:99999:7::: ftpuser:!:15752:0:99999:7::: ftp:*:15752:0:99999:7::: spdftp:xxxx:15754:0:99999:7::: scftp:xxxx:15754:0:99999:7::: 

Hier ist die Ausgabe der Datei / etc / passwd für diese Benutzer:

spdftp:x:5005:1002::/var/www/path/to/home:/bin/sh scftp:x:5006:1002::/var/www/path/to/home:/bin/sh 

Für die Aufzeichnung habe ich den Befehl verwendet:

useradd scftp -d /path/to/home/dir -g ftpusers 

um die Benutzer anzulegen. Ich habe kein Shell-Argument hinzugefügt, obwohl das System es auf / bin / sh gesetzt hat.

Ich chown -Rf / var / www spdftp und chown -Rf / var / www / path / to / home scftp (Ich möchte, dass der Benutzer spdftp als eine Art Master-FTP-Konto und -Scftp nur Zugriff auf einen bestimmten Site-Ordner hat). Ich habe auch chgrp-RF / var / www ftpusers

Die Datei /etc/vsftpd.conf lautet wie folgt:

# 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. # # Allow anonymous FTP? (Beware - allowed by default if you comment this out). 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   # Ignore shell login request check_shell=NO  # # 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 # # 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 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 # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=YES # # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6 # sockets, you must run two copies of vsftpd with two configuration files. # Make sure, that one of the listen options is commented !! #listen_ipv6=YES  pam_service_name=ftp 

Ich bin nicht sicher über die letzte Zeile. Ich dachte, es sollte pam_service_name = vsftpd sein, aber es hat sowieso nicht funktioniert.

Ich habe auch die vsftpd.chroot_list erstellt. Hier ist der Inhalt dieser Datei:

spdftp scftp 

Es gibt eine /etc/vsftpd.passwd -Datei, für diese beiden Benutzernamen sind jedoch keine Einträge vorhanden. Ich weiß nicht, wie ich sie erstellen oder hinzufügen soll, wenn dies das Problem ist.

Jede Hilfe wäre sehr dankbar. Ich habe sehr wenig Haare und was noch übrig ist, reiße ich raus!

AKTUALISIEREN

Ich habe die Shell jedes Benutzers in first, / bin / false und second / bin / bash geändert. Dies erlaubte mir zumindest, mich anzumelden, ohne den Fehler 530 Falscher Login zu erhalten. Ich erhalte jedoch nach diesem und dem folgenden Protokoll eine Netzwerk-Zeitüberschreitung (xxxx ist meine feste IP-Adresse):

Mon Feb 18 11:49:15 2013 [pid 2] CONNECT: Client "x.x.x.x" Mon Feb 18 11:49:15 2013 [pid 1] [scftp] OK LOGIN: Client "x.x.x.x" Mon Feb 18 11:50:48 2013 [pid 2] CONNECT: Client "x.x.x.x" Mon Feb 18 11:50:49 2013 [pid 1] [spdftp] OK LOGIN: Client "x.x.x.x" 

In der Datei /var/log/vsftpd.log ist kein Fehlergrund angegeben. Nicht sicher, ob es ein anderes Protokoll gibt, das ich überprüfen kann.

UPDATE 2

Ich habe festgestellt, dass ich einige Zeilen in der Datei vsftpd.conf hinterlassen habe:

#guest_enable=YES #guest_username=ftp  #user_config_dir=/etc/vsftpd/vusers 

Da ich den Weg zum Erstellen von virtuellen Benutzern begonnen hatte. Ich dachte, ich hätte das kommentiert, aber ich hatte es nicht getan.

Jetzt kann ich eine Verbindung herstellen. Mein letztes Problem ist, dass ich wieder da bin, wo ich angefangen habe und meine Benutzer keine Dateien auf den Server hochladen können. Der folgende Fehler ist in meinem vsftpd.log enthalten:

Mon Feb 18 12:13:54 2013 [pid 3] [spdftp] FAIL CHMOD: Client "x.x.x.x", "/path/to/home/folder/2013/humans.txt 777" 

Also, schließen Sie sich dem gleichen Thema. Jemand irgendwas

0

1 Antwort auf die Frage

0
tadywankenobi

Ich habe dieses Problem durch eine vollständige Bereinigung des vsftpd-Dienstes und der Installation behoben und dann erneut installiert. Irgendwann müssen meine Einstellungen in vsftpd gekreuzte Drähte oder Konflikte haben. Ich hatte vorher deinstalliert, wusste aber noch nicht:

aptitude purge vsftpd aptitude autoclean 

Einmal habe ich das gemacht und dann eine

aptitude install vsftpd 

Die einzige Einstellung, die ich in der vsftpd.conf ändern musste, war write_enable = YES. (Ich habe auch ein paar Einstellungen hinzugefügt, um sicherzustellen, dass Benutzer nicht aus ihrem Heimatordner navigieren können).