• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst]FTP-Server nur für lokales Netzwerk

Anthony

Member
Hallo Leute,

ich brauche wieder einmal eure Hilfe.
Folgendes ist geplant:
Ich möchte auf meinem PC einen FTP-Server mit vsftpd einrichten. Diese Lösung habe ich mir ausgesucht, da man hier auf den ersten Blick mehr einstellen kann ,als bei den anderen Prgrammen.

Auf meinem Server sollen private Dateien, wie z.B. Briefe und Fotos gespeichert sein. Aus diesem Grund soll der Server unter gar keinen Umständen aus dem INternet erreichbar sein. Es sollen also nur die Ip-Bereiche 192.168.100.2 bis 192.168.100.10 auf meinen Server zugreifen können. Der Server soll zusätzlich mit verschiedenen Usernamen und Passwörtern gesichert sein. Die Client-PC's im Netzwerk sollen Lese- und Schreibzugriff bekommen.

Vielleicht kann das auch mit Apache lösen? Ich habe nämlich schon einen Webserver eingerichtet, der jedoch gar nicht im Netzwerk erreichbar ist.

Ich habe von Servern unter Linux noch nicht so die Ahnung, also nicht aufregen, wenn ich etwas nicht sofort verstehe.

DAnke schon mal im Voraus.


mfg Anthony
 

spoensche

Moderator
Teammitglied
hast du auch windows clients im netzwerk? ich würde dir für das lokale netzwerk nfs (wenn nur linux clients da sind) oder samba wenn auch windows clients im netz sind.

aber wenn du unbedingt einen ftp-server haben willst guck mal unter: http://wiki.linux-club.de/opensuse/Ftp
 
OP
A

Anthony

Member
Es sind Linux und Windows PC's. Ist das nicht mit FTP am einfachsten, da ja auch Benutzer mit Passwörtern angelegt werden sollen?

Ich habe schon angefangen mit lesen, mit den IP-Bereichen sollte das ja einfach mit den /etc/hosts.deny und /etc/hosts.allow zu lösen sein. Bei deny müsste ich dann doch nur "all" und bei allow den IP-Bereich eintragen, oder?


mfg ANthony
 

spoensche

Moderator
Teammitglied
benutzer und passwörter kannst du auch mit samba machen, gleichzeitig kannst du auch noch drucker freigeben.

in der /etc/hosts.allow müsste dann der service und der ip adressbereich stehen, für den der zugriff gestattet ist. wie das geht steht ja in dem beispiel in der datei.

wegen samba kannst du ja mal unter http://wiki.linux-club.de/opensuse/Samba nachsehen
 
OP
A

Anthony

Member
ja, das wäre ein Alternative, aber erst würde ich es gerne mit FTP versuchen.

Ich werde mal damit anfangen, wenn es Probleme gibt melde ich mich wieder ;-)


mfg Anthony
 

pft

Advanced Hacker
woher kommt Deine Sorge, dass die Daten dem Internet ausgesetzt sein könnten?

Hast Du irgendwelche anderen Dienste von draussen erreichbar sind?

Wenn all clients nur "normal" im Internet surfen, dann kannst Du die Firewall am internetrouter doch dicht machen (kein! externer Zugriff whatsoever) und gut ist's
Note: Unter nicht-"normal" surfen fällt damit schon file sharing und instant messaging :shock: Halt alles was Löcher in der FW braucht

Wenn Du irgendwelche Dienste im Internet anbietest (egal welche!) wird es in jedem Fall gefährlich. Jedes noch so kleine Loch stellt eine potentielle Gefahr dar.

Du solltest dann über einen besseren setup mit expliziter DMZ nachdenken - notfalls auf Basis virtueller Maschienen statt realer (es gab da mal einen netten heise Artikel zu und auch den einen oder anderen Ansatz hier im Forum)

Apropos Webserver: "gar nicht im Netzerreichbar" - intern oder extern? Wenn gar nicht dann ist das eigentlich kein Server mehr :D
Fragen dazu bitte in separatem Thread posten
 
OP
A

Anthony

Member
der Webserver ist garnicht im Netzwerk erreichbar, weder intern noch außerhalb.

Das ist eine gute Idee mit den EInstellungen im Router, aber ich brauche Messenger, von daher geht diese LÖsung so nicht.

Wenn ich in meine hosts.deny dieses eintrage:

Code:
ALL:DENY

und in meine hosts.allow:

Code:
httpd: 192.168.100.1/10
vsftpd: 192.168.100.1/10

sollte der FTP-Server doch eigentlich nur noch im lokalen Netz erreichbar sein, oder?
Muss es in der hosts.allow eigentlich vsftpd heißen, oder anders?

danke schon mal für die ganze Mühe.


mfg Anthony
 
OP
A

Anthony

Member
ok, dann hätte ich das schon mal.

Ich habe jetzt mit xinetd vsftpd und tcpd und im Runlevel-Editor nochmal vsftpd aktiviert. Fehlt da noch etwas, damit ich meinen FTP-Server aufrufen kann?

Wenn ich ftp.localhost eingebe, kommt nämlich nur, dass der Server nicht gefunden wird. Oder ist das die falsche Adresse?


mfg Anthony
 

spoensche

Moderator
Teammitglied
ist vsftpd gestartet? hast du die ports in der firewall geöffnet? was sagen die logfiles? /var/log/warn u. /var/log/messages u. das logfile von vsftp.

lass das ftp vor dem localhost mal weg. versuch auch mal ftp://deine-ip o. ftp://dein-hostname
 
OP
A

Anthony

Member
ich glaub der Fehler liegt noch davor:

Beim start von vsftpd:
Code:
COmputer:~ # /etc/init.d/vsftpd start
Starting vsftpd startproc:  exit status of parent of /usr/sbin/vsftpd: 1
                                                                     failed
COmputer:~ #

/var/log/warn:
Mar 18 15:24:41 COmputer kernel: end_request: I/O error, dev sdc, sector 238453
Mar 18 15:25:02 COmputer startproc: startproc: exit status of parent of /usr/bin/torctl: 1
Mar 18 15:25:23 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1
Mar 18 15:25:28 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1
Mar 18 15:26:24 COmputer syslog-ng[2263]: last message repeated 3 times
Mar 18 15:31:21 COmputer sudo: pam_unix2(sudo:auth): conversation failed
Mar 18 15:31:57 COmputer startproc: startproc: exit status of parent of /usr/bin/torctl: 1
Mar 18 15:32:06 COmputer xinetd[15184]: Exiting...
Mar 18 15:32:23 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1
Mar 18 15:43:12 COmputer startproc: startproc: exit status of parent of /usr/bin/torctl: 1
Mar 18 15:46:02 COmputer startproc: startproc: exit status of parent of /usr/bin/torctl: 1
Mar 18 16:03:32 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1
Mar 18 16:03:46 COmputer kernel: end_request: I/O error, dev sdc, sector 488397160
Mar 18 16:03:46 COmputer kernel: Buffer I/O error on device sdc, logical block 61049645
Mar 18 16:04:22 COmputer startproc: startproc: exit status of parent of /usr/bin/torctl: 1
Mar 18 16:04:25 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1
Mar 18 16:06:34 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1
Mar 18 16:07:30 COmputer syslog-ng[2263]: last message repeated 2 times
Mar 18 16:08:48 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1

/var/log/mesages:

Mar 18 16:04:22 COmputer startproc: startproc: exit status of parent of /usr/bin/torctl: 1
Mar 18 16:04:25 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1
Mar 18 16:06:02 COmputer xinetd[19004]: Starting reconfiguration
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/chargen [file=/etc/xinetd.conf] [line=26]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/chargen-udp [file=/etc/xinetd.d/chargen-udp] [line=13]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/cups-lpd [file=/etc/xinetd.d/cups-lpd] [line=14]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/cvs [file=/etc/xinetd.d/cvs] [line=11]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/daytime [file=/etc/xinetd.d/daytime] [line=15]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/daytime-udp [file=/etc/xinetd.d/daytime-udp] [line=13]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/discard [file=/etc/xinetd.d/discard] [line=14]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/discard-udp [file=/etc/xinetd.d/discard-udp] [line=13]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/echo [file=/etc/xinetd.d/echo] [line=14]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/echo-udp [file=/etc/xinetd.d/echo-udp] [line=13]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/netstat [file=/etc/xinetd.d/netstat] [line=14]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/rexec [file=/etc/xinetd.d/rexec] [line=15]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/rlogin [file=/etc/xinetd.d/rlogin] [line=18]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/rsh [file=/etc/xinetd.d/rsh] [line=24]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/rsync [file=/etc/xinetd.d/rsync] [line=22]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/sane-port [file=/etc/xinetd.d/sane-port] [line=12]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/servers [file=/etc/xinetd.d/servers] [line=14]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/services [file=/etc/xinetd.d/services] [line=13]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/systat [file=/etc/xinetd.d/systat] [line=13]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/time [file=/etc/xinetd.d/time] [line=16]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/time-udp [file=/etc/xinetd.d/time-udp] [line=14]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/vnc [file=/etc/xinetd.d/vnc] [line=14]
Mar 18 16:06:02 COmputer xinetd[19004]: Reading included configuration file: /etc/xinetd.d/vsftpd [file=/etc/xinetd.d/vsftpd] [line=90]
Mar 18 16:06:02 COmputer xinetd[19004]: Swapping defaults
Mar 18 16:06:02 COmputer xinetd[19004]: readjusting service ftp
Mar 18 16:06:02 COmputer xinetd[19004]: readjusting service exec
Mar 18 16:06:02 COmputer xinetd[19004]: Reconfigured: new=0 old=2 dropped=0 (services)
Mar 18 16:06:34 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1
Mar 18 16:07:01 COmputer syslog-ng[2263]: last message repeated 2 times
Mar 18 16:07:01 COmputer su: (to root) anthony on /dev/pts/4
Mar 18 16:08:48 COmputer startproc: startproc: exit status of parent of /usr/sbin/vsftpd: 1

logfile von vsftpd existiert noch nicht.

hier noch der log von xinetd:

08/3/18@16:03:21: START: ftp from=192.168.100.2
08/3/18@16:03:21: EXIT: ftp status=1 duration=0(sec)

die anderen URL's funktionieren auch nicht.


mfg ANthony
 

pft

Advanced Hacker
da hast Du wohl noch einen Fehler in der config vom vsftpd.
Vielleicht zeigst Du uns einfach mal

Zum Thema security nochmal:
ja das mit hosts allow/deny geht natürlich, ist aber nur bedingt sicher.
Kommt halt drauf an wie sensibel deine Daten sind - KOntoauszüge aus Liechtentein solltest Du nicht auf dem Server haben :D
 
OP
A

Anthony

Member
nee, so empfindlich sind sie nun auch wieder nicht, sind halt Briefe, Bilder und so :wink:

an der config habe ich noch nicht so viel geändert:


# 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.
#
# If you do not change anything here you will have a minimum setup for an
# anonymus FTP server.
#
# 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.

# General Settings
#
# Uncomment this to enable any form of FTP write command.
#
write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
#
dirmessage_enable=YES
#
# 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
#
# You may fully customise the login banner string:
#
#ftpd_banner="Welcome to FOOBAR FTP service."
#
# 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
#
# 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
#
# If enabled, all user and group information in
# directory listings will be displayed as "ftp".
#
#hide_ids=YES

# Local FTP user Settings
#
# Uncomment this to allow local users to log in.
#
#local_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 to put local users in a chroot() jail in their home directory
# after login.
#
#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().
#
#chroot_list_enable=YES
#
# (default follows)
#
#chroot_list_file=/etc/vsftpd.chroot_list
#
# The maximum data transfer rate permitted, in bytes per second, for
# local authenticated users. The default is 0 (unlimited).
#
#local_max_rate=7200


# Anonymus FTP user Settings
#
# Allow anonymous FTP?
#
anonymous_enable=NO
#
# Anonymous users will only be allowed to download files which are
# world readable.
#
anon_world_readable_only=YES
#
# 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=NO
#
# Default umask for anonymus users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#
#anon_umask=022
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#
#anon_mkdir_write_enable=YES
#
# Uncomment this to enable anonymus FTP users to perform other write operations
# like deletion and renaming.
#
#anon_other_write_enable=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
#
# The maximum data transfer rate permitted, in bytes per second, for anonymous
# authenticated users. The default is 0 (unlimited).
#
#anon_max_rate=7200


# Log Settings
#
# Log to the syslog daemon instead of using an logfile.
#
syslog_enable=YES
#
# Uncomment this to log all FTP requests and responses.
#
log_ftp_protocol=YES
#
# Activate logging of uploads/downloads.
#
#xferlog_enable=YES
#
# You may override where the log file goes if you like. The default is shown
# below.
#
#vsftpd_log_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note: This disables the normal logging unless you enable dual_log_enable below.
#
#xferlog_std_format=YES
#
# You may override where the log file goes if you like. The default is shown
# below.
#
#xferlog_file=/var/log/xferlog
#
# Enable this to have booth logfiles. Standard xferlog and vsftpd's own style log.
#
#dual_log_enable=YES
#
# Uncomment this to enable session status information in the system process listing.
#
#setproctitle_enable=YES

# Transfer Settings
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
#
connect_from_port_20=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
#
# 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 turning on ascii_download_enable enables malicious remote parties
# to consume your I/O resources, by issuing the command "SIZE /big/file" in
# ASCII mode.
# These ASCII options are split into upload and download because you may wish
# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
#
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# Set to NO if you want to disallow the PASV method of obtaining a data
# connection.
#
#pasv_enable=NO

# PAM setting. Do NOT change this unless you know what you do!
#
pam_service_name=vsftpd

# Set listen=YES if you want vsftpd to run standalone
#
listen=NO

# Set to ssl_enable=YES if you want to enable SSL
ssl_enable=NO


mfg Anthony
 

pft

Advanced Hacker
das sieht gut aus - abgesehen von den Kommentarzeilen. Die will hier wirklich keiner sehen. Schäm Dich :evil:

Muss der Fehler noch woanders liegen.

Wie willst Du den vsftpd denn starten, als Dauerläufer / beim Booten, also über die Runlevelverwaltung, oder nur bei Bedarf d.h. über den xinetd?

Ich habe das Gefühl Du tust beides, also entscheide dich: entweder im runlevel deaktivieren oder in der xinet-config

BTW, dass dein vsftpd logfile leer ist ist normal - Du hast ja im configfile schließlich "syslog" aktiviert

Starte ihn doch einfach mal auf der Kommandozeile und zeig uns die Fehlermeldungen
 
OP
A

Anthony

Member
Im Runlevel Editor lässt sich vsftpd nicht starten:

Code:
/etc/init.d/vsftpd start gab 7 (Programm wird nicht ausgeführt) zurück:


In der KOnsole per root:

Code:
COmputer:~ # /etc/init.d/vsftpd start
Starting vsftpd startproc:  exit status of parent of /usr/sbin/vsftpd: 1
                                                                     failed
COmputer:~ # /etc/init.d/vsftpd status
Checking for service vsftpd                                          unused
COmputer:~ # /etc/init.d/vsftpd stop
Shutting down vsftpd                                                 done
COmputer:~ # /etc/init.d/vsftpd status
Checking for service vsftpd                                          unused
COmputer:~ # /etc/init.d/vsftpd start
Starting vsftpd startproc:  exit status of parent of /usr/sbin/vsftpd: 1
                                                                     failed
COmputer:~ #

vsftpd ist also derzeit nur im xinetd aktiviert

sorry wegen der KOmmentare im config-file, ich dachte die interessieren vielleicht jemanden

mfg Anthony
 
OP
A

Anthony

Member
sieht nicht so aus:

Code:
COmputer:~ # ps -A | grep vsftpd
COmputer:~ #

Das ist irgendwie etwas komisch, denn:

Code:
COmputer:~ # /etc/init.d/vsftpd status
Checking for service vsftpd                                          unused
lässt darauf schließen, dass es läuft, oder verstehe ich das falsch?

mfg Anthony
 

pft

Advanced Hacker
das kann ich so auch nicht beurteilen, schon weil ich ihn nicht benutze.

Aber starte ihn doch mal von der Konsole, d.h. mit
Code:
rechner: # vsftpd
also nicht über das startskript. Und poste die Ausgaben, die dann folgen.
 
Oben