PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : ftp zugriff nur auf bestimmte verzeichnisse (vbftpd/ suse8)



cos
05.05.02, 14:50
wie kann ich bei einem ftp zugriff nur bestimmte verzeichnisse freigeben, so das der eizelne user nur auf die von mir gesetzen verzeichnisse einsicht nehmen kann? kann ich für jeden user etwas freigeben oder nur für eine gruppe. denn im moment kann der einzelne user auf dem ftp überall hin.

Newbie2001
05.05.02, 18:07
du kannst einen user via chroot in sein hoem-verzeichnis einsperren. Dazu must du "enable_chroot_list=yes" setzen und einen Datei namens /etc/vsftpd.chroot_list erstellen. dort schreibst du dann alle user rein (getrennt durch ein leerzeichen) die ihr homeverzeichnis nicht verlassen dürfen. wenn du nicht das standardhomeverzeichnis /home/username verwwenden willst dann kannst du in der /etc/passwd ja ein anderes angeben

cos
06.05.02, 00:06
kann ich sowas auch für die user machen die sich anonym anmelden? oder wird das da eh ganz anders gemacht. Wenn ja, wie!

ich habe das jetzt auch mal probiert mit der chroot _list aber das geht nicht. hier ist mal meine vsftp.conf vielleicht kannst du mir sagen was ich falsch mache. die datei vsftpd.chroot_list habe ich erstellt und auch einen namen des user reingeschrieben...

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are very paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
#
# Allow anonymous FTP?
#anonymous_enable=YES
#
# 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
#
# 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
#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 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
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to bla 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().
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

pam_service_name=vsftpd

Newbie2001
06.05.02, 10:57
eigentlich sollte es mit dieser config funktionieren. was funktioniert bei dir denn nicht ? Wenn du "anonymous_enable=yes" setzt dann wird anonymer login über den user "ftp" gestattet, d.h. ein User der sich als anonymous einloggt surft dann mit den rechten des users ftp und ist im home-dir des users ftp eingesperrt (chroot). Mit der variable "anon_root" kannst du ein untervezcihnis des home-dirs des users "ftp" angeben, in welches man nach dem anonymous-login gelangen soll. dieses muss allerdings ein untervzeichnis sein und es darf auch nicht der volle pfad angeben werde sondern der ab dem home-dir. kleines beispiel:
wenn du möchtest dein ein anonymous-user nach dem login in dieses verzeichnis kommt: /ftp/data/anonymous, dann kannst du folgendes machen:
1. du gibst dem user ftp das verzeichnis ftp als home-dir und stellst bei anon_root=/data/anonymous ein, dann kann ein anonymous-suer das verzeichnis data/anonymous allerdings verlassen und bis auf die ebene des verzeichnisses /ftp zurückgehen.
2. du gibst dem user ftp das verzeichnis /ftp/data/anonymous als home-dir und läßt anon_root weg dann kann ein anonymous das verzeichnis /ftp/data/anonymous nicht in übergeordnete verzeichnisses verlassen sondern nur die untergeordneten ansurfen, spirch /ftp/data/anonymous/dir1/subdir2

cos
06.05.02, 12:21
ob das mit dem anonymenzugriff geht weiß ich noch nicht, dazu bin ich noch nicht gekommen, aber wenn ich das mit einem localen user probiere kann ich trotz vsftpd.chroot_list in jedes verzeichnis wechseln. obwohl ich den usernamen in die datei eingetragen habe und auch vsftp_chroot_list=YES habe.
vielleicht mal was zu meiner konfiguration. ich probiere das im moment nur aus. d.h ich habe zwei rechner über twisted pair direkt verbunden. auf dem einen windows und dem anderen suse 8. und wenn ich für den windows ftp client mich mit einem localen user auf dem linux anmelde kann ich überall hin. oder muß ich einen anderen user nehmen? oder den anders einstellen???

Newbie2001
06.05.02, 13:02
hm, bist du sicher, dass der vsftpd als ftp-server vernwedet wird und nicht ein anderer. guck mal in der /etc/inetd.conf oder /etc/xinetd.conf was da als ftp-server eingetragen ist.

cos
06.05.02, 13:39
das ist meine inetd.conf

# See "man 8 inetd" for more information.
#
# If you make changes to this file, either reboot your machine or send the
# inetd a HUP signal with "/etc/init.d/inetd reload" or by hand:
# Do a "ps x" as root and look up the pid of inetd. Then do a
# "kill -HUP <pid of inetd>".
# The inetd will re-read this file whenever it gets that signal.
#
# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
#
# echo stream tcp nowait root internal
# echo dgram udp wait root internal
# discard stream tcp nowait root internal
# discard dgram udp wait root internal
# daytime stream tcp nowait root internal
# daytime dgram udp wait root internal
# chargen stream tcp nowait root internal
# chargen dgram udp wait root internal
time stream tcp nowait root internal
time dgram udp wait root internal
#
# These are standard services.
#
# ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd
ftp stream tcp nowait root /usr/sbin/tcpd vsftpd
#
# If you want telnetd not to "keep-alives" (e.g. if it runs over a ISDN
# uplink), add "-n". See 'man telnetd' for more details.
# telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd
# nntp stream tcp nowait news /usr/sbin/tcpd /usr/sbin/leafnode
# smtp stream tcp nowait root /usr/sbin/sendmail sendmail -L sendmail -Am -bs
#
# Shell, login, exec and talk are BSD protocols.
# The option "-h" permits ``.rhosts'' files for the superuser. Please look at
# man-page of rlogind and rshd to see more configuration possibilities about
# .rhosts files.
# shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L
# shell stream tcp nowait root /usr/sbin/tcpd in.rshd -aL
#
# If you want rlogind not to "keep-alives" (e.g. if it runs over a ISDN
# uplink), add "-n". See 'man rlogind' for more details.
login stream tcp nowait root /usr/sbin/tcpd in.rlogind
# login stream tcp nowait root /usr/sbin/tcpd in.rlogind -a
# exec stream tcp nowait root /usr/sbin/tcpd in.rexecd
# talk dgram udp wait root /usr/sbin/tcpd in.talkd
# ntalk dgram udp wait root /usr/sbin/tcpd in.talkd
# These entries are for the KDE version of talk. If you enable them,
# you have to disable the version above.
# talk dgram udp wait root /usr/sbin/tcpd /opt/kde2/bin/ktalkd
# ntalk dgram udp wait root /usr/sbin/tcpd /opt/kde2/bin/ktalkd
#
#
# Pop et al
#
# pop2 stream tcp nowait root /usr/sbin/tcpd in.pop2d
# pop3 stream tcp nowait root /usr/sbin/tcpd /usr/sbin/popper -s
#
# Imapd - Interactive Mail Access Protocol server
# Attention: This service is very insecure
# imap stream tcp nowait root /usr/sbin/tcpd imapd
#
# Comsat - has to do with mail.
#
# comsat dgram udp wait root /usr/sbin/tcpd in.comsat
#
# The Internet UUCP service.
#
# uucp stream tcp nowait uucp /usr/sbin/tcpd /usr/lib/uucp/uucico -l
#
# Tftp service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
#
# tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot
# bootps dgram udp wait root /usr/sbin/bootpd bootpd -c /tftpboot
#
# Finger, systat and netstat give out user information which may be
# valuable to potential "system crackers." Many sites choose to disable
# some or all of these services to improve security.
# Try "telnet localhost systat" and "telnet localhost netstat" to see that
# information yourself!
#
finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd -w
# systat stream tcp nowait nobody /usr/sbin/tcpd /bin/ps -auwwx
# netstat stream tcp nowait root /usr/sbin/tcpd /bin/netstat -a
#
# For man on the fly and ht://dig (full text search)
#
# http-rman stream tcp nowait.10000 nobody /usr/sbin/tcpd /usr/sbin/http-rman
#
# For XCept4
#
# btx stream tcp nowait root /usr/sbin/tcpd /usr/lib/xcept4/bin/ceptd -i/usr/lib/xcept4/etc/init.ceptd -u/usr/lib/xcept4/etc/users.ceptd -l/var/log/log.ceptd
#
# For rplay daemon
#
# Old versions of rplay:
# rplay dgram udp wait root /usr/sbin/tcpd rplayd -b 8192 -c 60 -s 8192
# New Versions of rplay (>=3.3.0)
# rplay dgram udp wait root /usr/sbin/tcpd rplayd -t 30 -c 60 -s 16384 -F0 --inetd
#
# vbox (Voice Box)
# vboxd stream tcp nowait root /usr/sbin/tcpd /usr/sbin/vboxd
#
# For midinetd
# midinet stream tcp nowait root /usr/sbin/tcpd in.midinetd
#
# swat is the Samba Web Administration Tool
# swat stream tcp nowait.400 root /usr/sbin/swat swat
#
#
# amanda backup server with indexing capabilities
# amandaidx stream tcp nowait amanda /usr/lib/amanda/amindexd amindexd
# amidxtape stream tcp nowait amanda /usr/lib/amanda/amidxtaped amidxtaped
#
# amanda backup client
# amanda dgram udp wait amanda /usr/lib/amanda/amandad amandad
#
# the rsync daemon
# rsync stream tcp nowait root /usr/sbin/tcpd /usr/sbin/rsyncd --daemon
#
#
# Mimer database
# mimer stream tcp nowait root /opt/mimer/bin/mimtcp mimtcp -l
#
# CVS pserver (remote acces to your CVS repositories)
# Please read the section on security and passwords in the CVS manual,
# before you enable this.
# cvspserver stream tcp nowait root /usr/sbin/tcpd /usr/bin/cvs -f --allow-root=/home/cvsroot pserver
#
# procstatd deamon (cluster software)
# procstatd stream tcp nowait nobody /usr/sbin/tcpd /usr/sbin/procstatd -i 7885
#
# End.

cos
07.05.02, 11:39
ich weiß jetzt warum das bei mir nicht ging. das ich die user nicht in ihr home einsperren kann. ich war auf dem server mit dem user namen ganz normal im kde angemeldet. und dadurch wurde wahrscheinlich meine home-sperre ausser kraft gesetzt. was meinst du dazu? ist das so wie ich denke?