www.ProFTPD.de
13. März 2007, 19:30:51 *
Willkommen Gast. Bitte einloggen oder registrieren.
Haben Sie Ihre Aktivierungs E-Mail übersehen?

Einloggen mit Benutzername, Passwort und Sitzungslänge
News: SMF - Neu installiert!
 
   Übersicht   Hilfe Suche Login Registrieren  
Seiten: [1]   Nach unten
  Drucken  
Autor Thema: mysql chroot funktioniert nicht...  (Gelesen 737 mal)
0 Mitglieder und 1 Gast betrachten dieses Thema.
scuba303
ProFTPD
*
Offline Offline

Beiträge: 8


Profil anzeigen
« am: 05. Februar 2004, 13:58:59 »

hallo. bei mir funktioniert der wechsel in das homedir nicht.

xxx.xxx.xxx.xxx - Preparing to chroot() the environment, path = '~/'
xxx.xxx.xxx.xxx - ralph chroot("~/"): No such file or directory
xxx.xxx.xxx.xxx - error: unable to set default root directory
xxx.xxx.xxx.xxx - FTP session closed.

also login selber funktioniert. muss ich meinem user eine gruppen & user id im table hinterlegen? und wie ist die homedir syntax richtig? also mit führenden / und end / (/user/homedir/) oder doch eher /user/homedir
Gespeichert
stonki
Administrator
ProFTPD
*****
Offline Offline

Beiträge: 1853


15318939
Profil anzeigen WWW E-Mail
« Antwort #1 am: 05. Februar 2004, 14:17:56 »

Zitat von: "scuba303"
hallo. bei mir funktioniert der wechsel in das homedir nicht.

xxx.xxx.xxx.xxx - Preparing to chroot() the environment, path = '~/'
xxx.xxx.xxx.xxx - ralph chroot("~/"): No such file or directory
xxx.xxx.xxx.xxx - error: unable to set default root directory
xxx.xxx.xxx.xxx - FTP session closed.

also login selber funktioniert. muss ich meinem user eine gruppen & user id im table hinterlegen? und wie ist die homedir syntax richtig? also mit führenden / und end / (/user/homedir/) oder doch eher /user/homedir


Welches HomeDir hat denn  der SQL User ?
Welche UID. GID hat der SQL User ?
Darf dieser User auf as Verzeichnis zugreifen ?
Gespeichert

www.stonki.de:    the more I see, the more I know.......
www.proftpd.de:   Deutsche ProFTPD Dokumentation
www.krename.net:  Der Batch Renamer für KDE
www.kbarcode.net: Die Barcode Solution für KDE
scuba303
ProFTPD
*
Offline Offline

Beiträge: 8


Profil anzeigen
« Antwort #2 am: 05. Februar 2004, 14:26:33 »

also, hab mal
DefaultRoot ~ !users
auf
DefaultRoot  /  !users
geändert.

da kriege ich dann immerhin
ralph chdir("/home/das/ziel"): Permission denied

also übernimmt er da die direcoty, die ich ihm in der db gebe.

habe meinem user ralph uid und gid von dem user gegeben, dem das verzeichnis gehört. hatte es aber vor eh auf chmod 777 gesetzt.
Gespeichert
stonki
Administrator
ProFTPD
*****
Offline Offline

Beiträge: 1853


15318939
Profil anzeigen WWW E-Mail
« Antwort #3 am: 05. Februar 2004, 14:54:38 »

Zitat von: "scuba303"
also, hab mal
DefaultRoot ~ !users
auf
DefaultRoot  /  !users
geändert.

da kriege ich dann immerhin
ralph chdir("/home/das/ziel"): Permission denied

also übernimmt er da die direcoty, die ich ihm in der db gebe.

habe meinem user ralph uid und gid von dem user gegeben, dem das verzeichnis gehört. hatte es aber vor eh auf chmod 777 gesetzt.



proftpd -n -d5 und Dir die Ausgabe anschauen.
Gespeichert

www.stonki.de:    the more I see, the more I know.......
www.proftpd.de:   Deutsche ProFTPD Dokumentation
www.krename.net:  Der Batch Renamer für KDE
www.kbarcode.net: Die Barcode Solution für KDE
scuba303
ProFTPD
*
Offline Offline

Beiträge: 8


Profil anzeigen
« Antwort #4 am: 05. Februar 2004, 15:07:55 »

Zitat
xxx.xxx.xxx.xxx - FTP session opened.
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'USER ralph' to mod_tls
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'USER ralph' to mod_rewrite
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'USER ralph' to mod_core
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'USER ralph' to mod_core
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'USER ralph' to mod_auth
xxx.xxx.xxx.xxx - dispatching CMD command 'USER ralph' to mod_auth
xxx.xxx.xxx.xxx - no supplemental groups found for user 'ralph'
xxx.xxx.xxx.xxx - dispatching POST_CMD command 'USER ralph' to mod_sql
xxx.xxx.xxx.xxx - dispatching LOG_CMD command 'USER ralph' to mod_sql
xxx.xxx.xxx.xxx - dispatching LOG_CMD command 'USER ralph' to mod_log
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'PASS (hidden)' to mod_tls
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'PASS (hidden)' to mod_rewrite
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'PASS (hidden)' to mod_core
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'PASS (hidden)' to mod_core
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'PASS (hidden)' to mod_wrap
xxx.xxx.xxx.xxx - dispatching PRE_CMD command 'PASS (hidden)' to mod_auth
xxx.xxx.xxx.xxx - dispatching CMD command 'PASS (hidden)' to mod_auth
xxx.xxx.xxx.xxx - no supplemental groups found for user 'ralph'
xxx.xxx.xxx.xxx -
xxx.xxx.xxx.xxx - Config for SEVERNAME:
xxx.xxx.xxx.xxx - /*
xxx.xxx.xxx.xxx -  Limit
xxx.xxx.xxx.xxx -   AllowAll
xxx.xxx.xxx.xxx -  Limit
xxx.xxx.xxx.xxx -   AllowAll
xxx.xxx.xxx.xxx -  AllowOverwrite
xxx.xxx.xxx.xxx -  HideNoAccess
xxx.xxx.xxx.xxx -  DisplayLogin
xxx.xxx.xxx.xxx -  DisplayFirstChdir
xxx.xxx.xxx.xxx -  HiddenStores
xxx.xxx.xxx.xxx -  DirFakeUser
xxx.xxx.xxx.xxx -  DirFakeGroup
xxx.xxx.xxx.xxx -  DirFakeMode
xxx.xxx.xxx.xxx -  SQLAuthTypes
xxx.xxx.xxx.xxx -  SQLAuthenticate
xxx.xxx.xxx.xxx -  SQLConnectInfo
xxx.xxx.xxx.xxx -  SQLDefaultGID
xxx.xxx.xxx.xxx -  SQLDefaultUID
xxx.xxx.xxx.xxx -  SQLMinUserGID
xxx.xxx.xxx.xxx -  SQLMinUserUID
xxx.xxx.xxx.xxx -  SQLLog_PASS
xxx.xxx.xxx.xxx -  SQLNamedQuery_counter
xxx.xxx.xxx.xxx -  SQLLog_RETR
xxx.xxx.xxx.xxx -  SQLLog_STOR
xxx.xxx.xxx.xxx -  SQLNamedQuery_transfer1
xxx.xxx.xxx.xxx -  SQLLog_ERR_RETR
xxx.xxx.xxx.xxx -  SQLLog_ERR_STOR
xxx.xxx.xxx.xxx -  SQLNamedQuery_transfer2
xxx.xxx.xxx.xxx -  AllowForeignAddress
xxx.xxx.xxx.xxx -  Umask
xxx.xxx.xxx.xxx -  MaxClientsPerHost
xxx.xxx.xxx.xxx -  MaxClients
xxx.xxx.xxx.xxx -  AllowStoreRestart
xxx.xxx.xxx.xxx -  AllowRetrieveRestart
xxx.xxx.xxx.xxx -  TransferLog
xxx.xxx.xxx.xxx -  RequireValidShell
xxx.xxx.xxx.xxx - ServerIdent
xxx.xxx.xxx.xxx - DeferWelcome
xxx.xxx.xxx.xxx - DefaultServer
xxx.xxx.xxx.xxx - DisplayLogin
xxx.xxx.xxx.xxx - DisplayConnect
xxx.xxx.xxx.xxx - DisplayFirstChdir
xxx.xxx.xxx.xxx - HiddenStores
xxx.xxx.xxx.xxx - DirFakeUser
xxx.xxx.xxx.xxx - DirFakeGroup
xxx.xxx.xxx.xxx - DirFakeMode
xxx.xxx.xxx.xxx - AuthPAM
xxx.xxx.xxx.xxx - SQLAuthTypes
xxx.xxx.xxx.xxx - SQLAuthenticate
xxx.xxx.xxx.xxx - SQLConnectInfo
xxx.xxx.xxx.xxx - SQLDefaultGID
xxx.xxx.xxx.xxx - SQLDefaultUID
xxx.xxx.xxx.xxx - SQLMinUserGID
xxx.xxx.xxx.xxx - SQLMinUserUID
xxx.xxx.xxx.xxx - SQLUserTable
xxx.xxx.xxx.xxx - SQLUsernameField
xxx.xxx.xxx.xxx - SQLPasswordField
xxx.xxx.xxx.xxx - SQLUidField
xxx.xxx.xxx.xxx - SQLGidField
xxx.xxx.xxx.xxx - SQLHomedirField
xxx.xxx.xxx.xxx - SQLShellField
xxx.xxx.xxx.xxx - SQLLog_PASS
xxx.xxx.xxx.xxx - SQLNamedQuery_counter
xxx.xxx.xxx.xxx - SQLLog_RETR
xxx.xxx.xxx.xxx - SQLLog_STOR
xxx.xxx.xxx.xxx - SQLNamedQuery_transfer1
xxx.xxx.xxx.xxx - SQLLog_ERR_RETR
xxx.xxx.xxx.xxx - SQLLog_ERR_STOR
xxx.xxx.xxx.xxx - SQLNamedQuery_transfer2
xxx.xxx.xxx.xxx - AllowForeignAddress
xxx.xxx.xxx.xxx - Umask
xxx.xxx.xxx.xxx - UserID
xxx.xxx.xxx.xxx - UserName
xxx.xxx.xxx.xxx - GroupID
xxx.xxx.xxx.xxx - GroupName
xxx.xxx.xxx.xxx - MaxClientsPerHost
xxx.xxx.xxx.xxx - MaxClients
xxx.xxx.xxx.xxx - AllowStoreRestart
xxx.xxx.xxx.xxx - AllowRetrieveRestart
xxx.xxx.xxx.xxx - IdentLookups
xxx.xxx.xxx.xxx - TimeoutStalled
xxx.xxx.xxx.xxx - TransferLog
xxx.xxx.xxx.xxx - ExtendedLog
xxx.xxx.xxx.xxx - ExtendedLog
xxx.xxx.xxx.xxx - ExtendedLog
xxx.xxx.xxx.xxx - DefaultRoot
xxx.xxx.xxx.xxx - MaxLoginAttempts
xxx.xxx.xxx.xxx - RequireValidShell
xxx.xxx.xxx.xxx - CURRENT-CLIENTS
xxx.xxx.xxx.xxx - USER
xxx.xxx.xxx.xxx - USER ralph: Login successful.
xxx.xxx.xxx.xxx - ralph chdir("/home/www/web2/html/fileadmin/kunden/dude"): Permission denied
xxx.xxx.xxx.xxx - FTP session closed.


Zitat
#
# Basic
#
ServerName         "mein server"
serverType         standalone
ServerAdmin         meine@email.de

#
# Debug Level
# emerg, alert, crit (empfohlen), error, warn. notice, info, debug
#
#SyslogLevel          emerg
#SystemLog         /var/log/proftpd.system.log

#
# uncomment, if you want to hide the servers name:
#
ServerIdent         on   "mein server"
DeferWelcome         on
DefaultServer         on

#
# Display
#
DisplayLogin         /messages/ftp.motd
DisplayConnect         /net/messages/ftp.pre
DisplayFirstChdir      index.txt

HiddenStor         off
DirFakeUser         on meinfake
DirFakeGroup         on meinfake
DirFakeMode         0000


# Enable PAM for authentication...
#
AuthPAM            on

# Setting this directive to on will cause authentication to fail
# if PAM authentication fails. The default setting, off, allows
# other modules and directives such as AuthUserFile and friends
# to authenticate users.
#
# AuthPAMAuthoritative      on

# This directive allows you to specify the PAM service name used
# in authentication (default is "proftpd" on SuSE Linux).
# You have to setup the service in the /etc/pam.d/<other_name>.
#
#AuthPAMConfig         <other_name>

# Port 21 is the standard FTP port.
Port            9999

#------------------------mysql Modul: 4.x
#
# Zugangskontrolle
#
SQLAuthTypes         Plaintext
SQLAuthenticate         users*
SQLConnectInfo         db@localhost user pass
SQLDefaultGID         65534
SQLDefaultUID         65534
SQLMinUserGID          100
SQLMinUserUID                                         500
SQLUserInfo         ftp username password uid gid homedir shell

#
# aktive SQL Kommandos, ab hier passiert etwas :-)
#
SQLLog PASS counter
SQLNamedQuery counter UPDATE "letzter_zugriff=now(), count=count+1 WHERE username='%u'" ftp

# xfer Log in mysql
SQLLog RETR,STOR transfer1
SQLNamedQuery  transfer1 INSERT "'%u', '%f', '%b', '%h', '%a', '%m', '%T', now(), 'c', NULL" xfer_stat

SQLLOG ERR_RETR,ERR_STOR transfer2
SQLNamedQuery  transfer2 INSERT "'%u', '%f', '%b', '%h', '%a', '%m', '%T', now(), 'i', NULL" xfer_stat

#------------------------mysql

# Port 21 is the standard FTP port.
Port                            9999

# disable listen on 0.0.0.0:21 - the port (and IP) should
# be specified explicitly in each VirtualHost definition
#
#Port                           0

# listen for each (additional) address explicitly that is
# specified (via Bind and Port) in a VirtualHost definition
#
#SocketBindTight      on

#
# FXP Unterstuetzung
#
AllowForeignAddress       on


# Umask 022 is a good standard umask to prevent new dirs
# and files from being group and world writable.
Umask            002

# Set the user and group that the server normally runs at.
User            nobody
Group            nogroup

# Maximal Werte setzen
MaxClientsPerHost   10   "Nicht mehr als %m  Verbindungen"
MaxClients      10    "Leider sind schon %m Clients verbunden"

# RateReadBPS             5000
# RateReadFreeBytes       5000
# RateReadHardBPS         on

#Classes on
#Class default           limit 5
#Class internet          limit 2
#Class local             limit 3
#Class internet          ip 0.0.0.0/0
#Class internet      ip 192.168.99.99/24
#Class local             ip 127.0.0.1/24
#Class local             ip 192.168.0.0/24

#
# Restart erlauben
#
AllowStoreRestart             on
AllowRetrieveRestart            on

# Normally, we want files to be overwriteable.
<Directory /*>
   AllowOverwrite          off
    HideNoAccess         on
   <Limit READ>
    AllowAll
   </Limit>
   <Limit Write>
   # DenyAll
         AllowAll
    </Limit>
</Directory>




# It is a very good idea to allow only filenames containing normal
# alphanumeric characters for uploads (and not shell code...)
#PathAllowFilter "^[a-zA-Z0-9_.-]()'+$"
#PathAllowFilter "^[a-zA-Z0-9 _.-]()'+$"

# We don't want .ftpaccess or .htaccess files to be uploaded
#PathDenyFilter "(\.ftp)|(\.ht)[a-z]+$"
#PathDenyFilter "\.ftp[a-z]+$"

# Do not allow to pass printf-Formats (security! see documentation!):
#AllowFilter "^[a-zA-Z0-9@~ /,_.-]*$"
#DenyFilter  "%"

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# such as xinetd)
MaxInstances         30

# Performance: skip DNS resolution when we process the logs...
UseReverseDNS             on

# Turn off Ident lookups
IdentLookups              on

# Set the maximum number of seconds a data connection is allowed
# to "stall" before being aborted.
TimeoutStalled                  300

# Where do we put the pid files?
ScoreboardFile         /var/run/proftpd.scoreboard

#
# Logging options
#
TransferLog                /var/log/proftpd.xferlog

# Some logging formats
#
LogFormat            default "%h %l %u %t \"%r\" %s %b"
LogFormat            auth    "%v [%P] %h %t \"%r\" %s"
LogFormat            write   "%h %l %u %t \"%r\" %s %b"

# Log file/dir access
ExtendedLog               /var/log/proftpd.access_log    WRITE,READ write

# Record all logins
ExtendedLog                /var/log/proftpd.auth_log      AUTH auth

# Paranoia logging level....
ExtendedLog                /var/log/proftpd.paranoid_log  ALL default

#
# Do a chroot for web-users (i.e. public or www group), but
# do not change root if the user is also in the users group...
#
DefaultRoot  /   !users

#
# Limit login attempts
#
MaxLoginAttempts                3

#
# Users needs a valid shell
#
RequireValidShell               off


muss dir fake user ein real existierender user im system sein? also auf linux ebene?
und muss ich die hier auch anpassen?
SQLDefaultGID                   65534
SQLDefaultUID                   65534
SQLMinUserGID                   100
SQLMinUserUID                   500
Gespeichert
stonki
Administrator
ProFTPD
*****
Offline Offline

Beiträge: 1853


15318939
Profil anzeigen WWW E-Mail
« Antwort #5 am: 05. Februar 2004, 15:54:16 »

nimm a) mal die Defaultroot Direktive raus und dann schau Dir mal die Zeilen vom Debug log an:

 ralph chdir("/home/www/web2/html/fileadmin/kunden/dude"): Permission denied
Gespeichert

www.stonki.de:    the more I see, the more I know.......
www.proftpd.de:   Deutsche ProFTPD Dokumentation
www.krename.net:  Der Batch Renamer für KDE
www.kbarcode.net: Die Barcode Solution für KDE
scuba303
ProFTPD
*
Offline Offline

Beiträge: 8


Profil anzeigen
« Antwort #6 am: 05. Februar 2004, 16:06:15 »

default root ist draussen, mit dem gleichen ergebnis.. Traurig
Gespeichert
stonki
Administrator
ProFTPD
*****
Offline Offline

Beiträge: 1853


15318939
Profil anzeigen WWW E-Mail
« Antwort #7 am: 05. Februar 2004, 16:30:21 »

Zitat von: "scuba303"
default root ist draussen, mit dem gleichen ergebnis.. Traurig

HAST DU DIR DIE (von mir gepostetete) DEBUG ZEILE ANGESCHAUT ! ?

sonst:  :root:  :wink:
Gespeichert

www.stonki.de:    the more I see, the more I know.......
www.proftpd.de:   Deutsche ProFTPD Dokumentation
www.krename.net:  Der Batch Renamer für KDE
www.kbarcode.net: Die Barcode Solution für KDE
scuba303
ProFTPD
*
Offline Offline

Beiträge: 8


Profil anzeigen
« Antwort #8 am: 05. Februar 2004, 17:03:07 »

hi stonki,

steh ja etwas auf dem schlauch... also.. meinen user ralph gibt es nur in dem table, den ich für den proftpd mysql spass angelegt habe. deute jetzt mal dein root zugriff so, dass meine user ralph root rechte hat?

also ziel meiner übung hier ist, dass ich später per typo3 einen frontend login machen kann, wo die kunden dateien uploaden können. wenn ich den login anlege, soll autmotisch in der db ein ftp user mit gleichen usernamen und passwort wie der login zum fe erstellt werden. daher wird mein homedir also im fileadmin/kunden liegen. ist das überhaupt so möglich, wie ich mir das hier vorstelle? nicht, dass ich voll auf dem holzweg bin... ;-)
Gespeichert
stonki
Administrator
ProFTPD
*****
Offline Offline

Beiträge: 1853


15318939
Profil anzeigen WWW E-Mail
« Antwort #9 am: 05. Februar 2004, 17:06:26 »

Zitat von: "scuba303"
hi stonki,

steh ja etwas auf dem schlauch... also.. meinen user ralph gibt es nur in dem table, den ich für den proftpd mysql spass angelegt habe. deute jetzt mal dein root zugriff so, dass meine user ralph root rechte hat?

also ziel meiner übung hier ist, dass ich später per typo3 einen frontend login machen kann, wo die kunden dateien uploaden können. wenn ich den login anlege, soll autmotisch in der db ein ftp user mit gleichen usernamen und passwort wie der login zum fe erstellt werden. daher wird mein homedir also im fileadmin/kunden liegen. ist das überhaupt so möglich, wie ich mir das hier vorstelle? nicht, dass ich voll auf dem holzweg bin... ;-)


Hallo, AHH Typo3: http://www.stonki.de/Typo3.24.0.html :)

Nein, das "ROOTZUGRIFF" meinte ich so, dass Du mir auch kurzzeitig mal root Zugriff geben kannst, damit ich mir das vorort anschaue. Mache ich oefters mal .. spart meist Zeit und Nerven.

Und was Du Dir vorstellst sollte moeglich sein....

cu
stonki
Gespeichert

www.stonki.de:    the more I see, the more I know.......
www.proftpd.de:   Deutsche ProFTPD Dokumentation
www.krename.net:  Der Batch Renamer für KDE
www.kbarcode.net: Die Barcode Solution für KDE
scuba303
ProFTPD
*
Offline Offline

Beiträge: 8


Profil anzeigen
« Antwort #10 am: 05. Februar 2004, 17:26:35 »

sie haben post.. ;-)
Gespeichert
stonki
Administrator
ProFTPD
*****
Offline Offline

Beiträge: 1853


15318939
Profil anzeigen WWW E-Mail
« Antwort #11 am: 06. Februar 2004, 13:19:54 »

so, um das Thema nun zu beenden und fuer das Archiv die Aufloesung zu bringen:

Das ganze hat nichts mit ProFTPD zu tun, sondern ist eine reine Linux (Unix) Angelenheit: Es muss darauf geachtet werden, das ein Verzeichnis auch fuer den User erreichbar ist. Dabei sind auch die Unterliegenden Verzeichnisse zu beachten.


Ich erstelle mal einige Verzeichnisse

test1
 !--- test2
         !---- test3

(alle gehoeren stonki.users, mit den Rechten 775)

Code:

stonki@database:~> cd test1/test2/test3/
stonki@database:~/test1/test2/test3>


klappt problemlos. Nun aendere ich nur von test1 die rechte auf


database:/home/stonki # ls -als | grep test1
   0 drwxrwxr-x    3 stonki   users          56 Feb  6 12:13 test1
database:/home/stonki # chown root.root test1
database:/home/stonki # chmod 700 test1
database:/home/stonki # ls -als | grep test1
   0 drwx------    3 root     root           56 Feb  6 12:13 test1

Kann ich nun als User "stonki" noch immer das Verzeichnis test3 erreichen. Das gehoert ja noch immer mir... Selbst das Unterverzeichnis (test2) gehoert mir ja auch noch...

Antwort: NEIN

stonki@database:~> cd test1/test2/test3/
bash: cd: test1/test2/test3/: Permission denied
stonki@database:~>

Also das bitte beachten, wenn man mit Verzeichnissen arbeitet.

cu
stonki
Gespeichert

www.stonki.de:    the more I see, the more I know.......
www.proftpd.de:   Deutsche ProFTPD Dokumentation
www.krename.net:  Der Batch Renamer für KDE
www.kbarcode.net: Die Barcode Solution für KDE
Seiten: [1]   Nach oben
  Drucken  
 
Gehe zu:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Prüfe XHTML 1.0 Prüfe CSS
Seite erstellt in 0.087 Sekunden mit 16 Zugriffen.