scponly und umask *ungelöst: nun rssh*
scponly und umask *ungelöst: nun rssh*
Hallo,
ich hab da ein kleines Problem mit scponly und umask.
scponly läuft bei mir für verschiede user in einer chroot Umgebung. Dort können sie ihre files in ihren document-root für Apache hochladen. Funktioniert soweit auch ganz prima.
Ein kleines Problem hab ich jedoch. Manche scripts (php, perl, usw.) benötigen write-Rechte aufs Verzeichnis, damit diese Dateien hochladen und speichern können (z.B. phpBB mit Uploadfunktion für die Avatare). Da mein Apache unter www-data:www-data läuft, hab ich nun alle relevanten Benutzer in die group www-data verschoben.
Allerdings ist die Standard-Umask beim hochladen (in oktaler Schreibweise) 755. Ich benötige aber für jede neue Datei 775 (oder umask 002), da ich das nicht immer manuell ändern will, wenn mal einer zu schreien anfängt... (es sind halt nunmal normale Anwender )
Wo kann ich das entsprechend einstellen?
Vielen Dank schonmal
cRoCoMo
ich hab da ein kleines Problem mit scponly und umask.
scponly läuft bei mir für verschiede user in einer chroot Umgebung. Dort können sie ihre files in ihren document-root für Apache hochladen. Funktioniert soweit auch ganz prima.
Ein kleines Problem hab ich jedoch. Manche scripts (php, perl, usw.) benötigen write-Rechte aufs Verzeichnis, damit diese Dateien hochladen und speichern können (z.B. phpBB mit Uploadfunktion für die Avatare). Da mein Apache unter www-data:www-data läuft, hab ich nun alle relevanten Benutzer in die group www-data verschoben.
Allerdings ist die Standard-Umask beim hochladen (in oktaler Schreibweise) 755. Ich benötige aber für jede neue Datei 775 (oder umask 002), da ich das nicht immer manuell ändern will, wenn mal einer zu schreien anfängt... (es sind halt nunmal normale Anwender )
Wo kann ich das entsprechend einstellen?
Vielen Dank schonmal
cRoCoMo
Zuletzt geändert von cRoCoMo am 24.05.2007 15:58:31, insgesamt 1-mal geändert.
O Genie, der Herr ehre dein Ego!
scponly ist eine restricted shell. Damit kann man usern nur das login mit scp und/oder sftp, nicht aber direkten shell Zugriff erlauben. Zum weiterlesen: klick
Nun zu deiner Antwort. Ich wüsste nicht welche Dateien sftp-server (ich erlaube nur sftp, kein scp) beim start ausführt, damit ich dort ein umask 002 platieren kann... Google hat bisher auch nix brauchbares ausgespuckt...
Weitere Vorschläge?
Nun zu deiner Antwort. Ich wüsste nicht welche Dateien sftp-server (ich erlaube nur sftp, kein scp) beim start ausführt, damit ich dort ein umask 002 platieren kann... Google hat bisher auch nix brauchbares ausgespuckt...
Weitere Vorschläge?
O Genie, der Herr ehre dein Ego!
den hab ich auch schon gefunden, bewirkt aber leider nix.
auch ~/.profile bewirkt nix...
ich bin langsam am verzweifeln.
rssh würde zwar eine umask per globaler (und auch user-spezifischer) .conf bieten, aber ich will nicht schon wieder migrieren, nachdem scponly schon ein stress zum einrichten war (von wegen nicht vorhandenem ~/dev/null im chroot usw.)
auch ~/.profile bewirkt nix...
ich bin langsam am verzweifeln.
rssh würde zwar eine umask per globaler (und auch user-spezifischer) .conf bieten, aber ich will nicht schon wieder migrieren, nachdem scponly schon ein stress zum einrichten war (von wegen nicht vorhandenem ~/dev/null im chroot usw.)
O Genie, der Herr ehre dein Ego!
- habakug
- Moderator
- Beiträge: 4314
- Registriert: 23.10.2004 13:08:41
- Lizenz eigener Beiträge: MIT Lizenz
Hallo!
In dem scponly-tar gibt es ein Skript namens "setup-chroot.sh.in". Dort heisst es:
Gruß, habakug
In dem scponly-tar gibt es ein Skript namens "setup-chroot.sh.in". Dort heisst es:
setup-chroot.sh.in hat geschrieben:please note that the user\'s home directory MUST NOT be writeable
by the scponly user. this is important so that the scponly user
cannot subvert the .ssh configuration parameters.
for this reason, a writeable subdirectory will be created that
the scponly user can write into.
Gruß, habakug
Hallo,
ich gebe dir Recht, nach der Readme müsste es eigentlich gehen. Ich habe aber bisher noch keine Datei gefunden, mit der man die umask ändern kann, ich stehe nämlich vor dem gleichen Problem wie cRoCoMo. Womöglich wird auch mir nichts anderes bleiben als der Umstieg auf rssh, wobei man dort für svnserve auch einen Patch einspielen muss. Aber lieber die Restricted Shell patchen als den OpenSSH Server.
mfg timo
ich gebe dir Recht, nach der Readme müsste es eigentlich gehen. Ich habe aber bisher noch keine Datei gefunden, mit der man die umask ändern kann, ich stehe nämlich vor dem gleichen Problem wie cRoCoMo. Womöglich wird auch mir nichts anderes bleiben als der Umstieg auf rssh, wobei man dort für svnserve auch einen Patch einspielen muss. Aber lieber die Restricted Shell patchen als den OpenSSH Server.
mfg timo
Ok, habe alle Accounts auf rssh umgestellt, auf den ersten Blick gefällt mir die rShell sehr gut.
Ich empfehle auch mit rssh die Jails als root:root 755 anzulegen und dann einen "incoming" Folder zu erstellen mit Schreibrechten für den User (genauso wie bei scponly).
Bei dem mkchroot.sh Script muss man für Debian ein paar Pfade anpassen. Auch die "standard"-Chroot-Probleme existieren 1zu1 bei rssh. Sprich man muss händisch die ld-linux.so kopieren und das /dev/null anlegen.
Ansonsten funktioniert es aber super, und auch die umask kann man ganz einfach setzen
Ich empfehle auch mit rssh die Jails als root:root 755 anzulegen und dann einen "incoming" Folder zu erstellen mit Schreibrechten für den User (genauso wie bei scponly).
Bei dem mkchroot.sh Script muss man für Debian ein paar Pfade anpassen. Auch die "standard"-Chroot-Probleme existieren 1zu1 bei rssh. Sprich man muss händisch die ld-linux.so kopieren und das /dev/null anlegen.
Ansonsten funktioniert es aber super, und auch die umask kann man ganz einfach setzen
Ok, hab mir rssh nun mal installiert und für nen test-user eingerichtet.
Per rssh.conf erlaube ich nur sftp.
chroot hab ich (mit angepassten pfaden) über das mkchroot.sh script erstellt.
Hab dann noch ~/dev/null erstellt, dem syslog-ng ein neues ~/dev/log zugewiesen und die ld-linux.so.2 ins chroot kopiert.
Soweit so gut. Nun will er mir aber nicht connecten... ist der typische "connection closed" Fehler.
Auszug /var/log/syslog
Auszug /var/log/auth.log
Kase, kannst du mir da vielleicht weiterhelfen?
Per rssh.conf erlaube ich nur sftp.
chroot hab ich (mit angepassten pfaden) über das mkchroot.sh script erstellt.
Hab dann noch ~/dev/null erstellt, dem syslog-ng ein neues ~/dev/log zugewiesen und die ld-linux.so.2 ins chroot kopiert.
Soweit so gut. Nun will er mir aber nicht connecten... ist der typische "connection closed" Fehler.
Auszug /var/log/syslog
Code: Alles auswählen
May 23 18:44:22 localhost rssh[15190]: setting log facility to LOG_USER
May 23 18:44:22 localhost rssh[15190]: line 52: configuring user test007
May 23 18:44:22 localhost rssh[15190]: setting test007's umask to 022
May 23 18:44:22 localhost rssh[15190]: allowing sftp to user test007
May 23 18:44:22 localhost rssh[15190]: chrooting test007 to /srv/test007
May 23 18:44:22 localhost rssh[15190]: user test007 attempted to execute forbidden commands
May 23 18:44:22 localhost rssh[15190]: command: /usr/lib/sftp-server
Code: Alles auswählen
May 23 18:44:22 localhost sshd[15187]: Accepted password for test007 from xxx.xxx.xxx.xxx port 64705 ssh2
May 23 18:44:22 localhost sshd[15189]: (pam_unix) session opened for user test007 by (uid=0)
May 23 18:44:22 localhost sshd[15189]: subsystem request for sftp
May 23 18:44:22 localhost sshd[15189]: (pam_unix) session closed for user test007
O Genie, der Herr ehre dein Ego!
ok
ls -laR /srv/test007
und hier die /etc/rssh.conf
ls -laR /srv/test007
Code: Alles auswählen
/srv/test007:
total 24
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 14 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 2 root root 4096 2007-05-23 18:31 dev
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 etc
drwxr-xr-x 3 root root 4096 2007-05-23 19:26 lib
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 usr
/srv/test007/dev:
total 8
drwxr-xr-x 2 root root 4096 2007-05-23 18:31 .
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 ..
srw-rw-rw- 1 root root 0 2007-05-23 18:31 log
crw-rw-rw- 1 root root 1, 3 2007-05-23 18:28 null
/srv/test007/etc:
total 44
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 ..
-rw-r--r-- 1 root root 17441 2007-05-23 18:26 ld.so.cache
-rw-r--r-- 1 root root 33 2007-05-23 18:26 ld.so.conf
-rw-r--r-- 1 root root 43 2007-05-23 18:26 ld.so.hwcappkgs
-rw-r--r-- 1 root root 475 2007-05-23 18:26 nsswitch.conf
-rw-r--r-- 1 root root 1964 2007-05-23 18:26 passwd
/srv/test007/lib:
total 364
drwxr-xr-x 3 root root 4096 2007-05-23 19:26 .
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 ..
-rw-r--r-- 1 root root 88164 2007-05-23 18:30 ld-linux.so.2
-rw-r--r-- 1 root root 5820 2007-05-23 18:26 libcom_err.so.2
-rw-r--r-- 1 root root 21868 2007-05-23 19:26 libcrypt.so.1
-rw-r--r-- 1 root root 9592 2007-05-23 19:26 libdl.so.2
-rw-r--r-- 1 root root 72452 2007-05-23 19:26 libnsl.so.1
-rw-r--r-- 1 root root 26332 2007-05-16 03:26 libnss_compat-2.3.6.so
lrwxrwxrwx 1 root root 22 2007-05-23 18:26 libnss_compat.so.2 -> libnss_compat-2.3.6.so
-rw-r--r-- 1 root root 34276 2007-05-16 03:26 libnss_files-2.3.6.so
lrwxrwxrwx 1 root root 21 2007-05-23 18:26 libnss_files.so.2 -> libnss_files-2.3.6.so
-rw-r--r-- 1 root root 59172 2007-05-23 19:25 libresolv.so.2
-rw-r--r-- 1 root root 9656 2007-05-23 19:25 libutil.so.1
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 tls
/srv/test007/lib/tls:
total 12
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 3 root root 4096 2007-05-23 19:26 ..
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 i686
/srv/test007/lib/tls/i686:
total 12
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 cmov
/srv/test007/lib/tls/i686/cmov:
total 1428
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 ..
-rw-r--r-- 1 root root 21868 2007-05-23 18:26 libcrypt.so.1
-rw-r--r-- 1 root root 1241392 2007-05-23 18:26 libc.so.6
-rw-r--r-- 1 root root 9592 2007-05-23 18:26 libdl.so.2
-rw-r--r-- 1 root root 76548 2007-05-23 18:26 libnsl.so.1
-rw-r--r-- 1 root root 67364 2007-05-23 18:26 libresolv.so.2
-rw-r--r-- 1 root root 9656 2007-05-23 18:26 libutil.so.1
/srv/test007/usr:
total 16
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 bin
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 lib
/srv/test007/usr/bin:
total 72
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 ..
-rwxr-xr-x 1 root root 20100 2007-05-23 18:26 rssh
-rwxr-xr-x 1 root root 43600 2007-05-23 18:26 scp
/srv/test007/usr/lib:
total 924
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 i686
-rw-r--r-- 1 root root 111708 2007-05-23 18:26 libgssapi_krb5.so.2
-rw-r--r-- 1 root root 151252 2007-05-23 18:26 libk5crypto.so.3
-rw-r--r-- 1 root root 508328 2007-05-23 18:26 libkrb5.so.3
-rw-r--r-- 1 root root 14504 2007-05-23 18:26 libkrb5support.so.0
-rw-r--r-- 1 root root 78500 2007-05-23 18:26 libz.so.1
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 rssh
-rwxr-xr-x 1 root root 36280 2007-05-23 18:26 sftp-server
/srv/test007/usr/lib/i686:
total 12
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 cmov
/srv/test007/usr/lib/i686/cmov:
total 1256
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 ..
-rw-r--r-- 1 root root 1270520 2007-05-23 18:26 libcrypto.so.0.9.8
/srv/test007/usr/lib/rssh:
total 28
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 ..
-rwxr-xr-x 1 root root 19412 2007-05-23 18:26 rssh_chroot_helper
rootserver:/usr/share/doc/rssh# ls -laR /srv/test007
/srv/test007:
total 24
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 14 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 2 root root 4096 2007-05-23 18:31 dev
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 etc
drwxr-xr-x 3 root root 4096 2007-05-23 19:26 lib
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 usr
/srv/test007/dev:
total 8
drwxr-xr-x 2 root root 4096 2007-05-23 18:31 .
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 ..
srw-rw-rw- 1 root root 0 2007-05-23 18:31 log
crw-rw-rw- 1 root root 1, 3 2007-05-23 18:28 null
/srv/test007/etc:
total 44
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 ..
-rw-r--r-- 1 root root 17441 2007-05-23 18:26 ld.so.cache
-rw-r--r-- 1 root root 33 2007-05-23 18:26 ld.so.conf
-rw-r--r-- 1 root root 43 2007-05-23 18:26 ld.so.hwcappkgs
-rw-r--r-- 1 root root 475 2007-05-23 18:26 nsswitch.conf
-rw-r--r-- 1 root root 1964 2007-05-23 18:26 passwd
/srv/test007/lib:
total 364
drwxr-xr-x 3 root root 4096 2007-05-23 19:26 .
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 ..
-rw-r--r-- 1 root root 88164 2007-05-23 18:30 ld-linux.so.2
-rw-r--r-- 1 root root 5820 2007-05-23 18:26 libcom_err.so.2
-rw-r--r-- 1 root root 21868 2007-05-23 19:26 libcrypt.so.1
-rw-r--r-- 1 root root 9592 2007-05-23 19:26 libdl.so.2
-rw-r--r-- 1 root root 72452 2007-05-23 19:26 libnsl.so.1
-rw-r--r-- 1 root root 26332 2007-05-16 03:26 libnss_compat-2.3.6.so
lrwxrwxrwx 1 root root 22 2007-05-23 18:26 libnss_compat.so.2 -> libnss_compat-2.3.6.so
-rw-r--r-- 1 root root 34276 2007-05-16 03:26 libnss_files-2.3.6.so
lrwxrwxrwx 1 root root 21 2007-05-23 18:26 libnss_files.so.2 -> libnss_files-2.3.6.so
-rw-r--r-- 1 root root 59172 2007-05-23 19:25 libresolv.so.2
-rw-r--r-- 1 root root 9656 2007-05-23 19:25 libutil.so.1
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 tls
/srv/test007/lib/tls:
total 12
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 3 root root 4096 2007-05-23 19:26 ..
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 i686
/srv/test007/lib/tls/i686:
total 12
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 cmov
/srv/test007/lib/tls/i686/cmov:
total 1428
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 ..
-rw-r--r-- 1 root root 21868 2007-05-23 18:26 libcrypt.so.1
-rw-r--r-- 1 root root 1241392 2007-05-23 18:26 libc.so.6
-rw-r--r-- 1 root root 9592 2007-05-23 18:26 libdl.so.2
-rw-r--r-- 1 root root 76548 2007-05-23 18:26 libnsl.so.1
-rw-r--r-- 1 root root 67364 2007-05-23 18:26 libresolv.so.2
-rw-r--r-- 1 root root 9656 2007-05-23 18:26 libutil.so.1
/srv/test007/usr:
total 16
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 6 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 bin
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 lib
/srv/test007/usr/bin:
total 72
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 ..
-rwxr-xr-x 1 root root 20100 2007-05-23 18:26 rssh
-rwxr-xr-x 1 root root 43600 2007-05-23 18:26 scp
/srv/test007/usr/lib:
total 924
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 i686
-rw-r--r-- 1 root root 111708 2007-05-23 18:26 libgssapi_krb5.so.2
-rw-r--r-- 1 root root 151252 2007-05-23 18:26 libk5crypto.so.3
-rw-r--r-- 1 root root 508328 2007-05-23 18:26 libkrb5.so.3
-rw-r--r-- 1 root root 14504 2007-05-23 18:26 libkrb5support.so.0
-rw-r--r-- 1 root root 78500 2007-05-23 18:26 libz.so.1
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 rssh
-rwxr-xr-x 1 root root 36280 2007-05-23 18:26 sftp-server
/srv/test007/usr/lib/i686:
total 12
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 ..
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 cmov
/srv/test007/usr/lib/i686/cmov:
total 1256
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 3 root root 4096 2007-05-23 18:26 ..
-rw-r--r-- 1 root root 1270520 2007-05-23 18:26 libcrypto.so.0.9.8
/srv/test007/usr/lib/rssh:
total 28
drwxr-xr-x 2 root root 4096 2007-05-23 18:26 .
drwxr-xr-x 4 root root 4096 2007-05-23 18:26 ..
-rwxr-xr-x 1 root root 19412 2007-05-23 18:26 rssh_chroot_helper
Code: Alles auswählen
logfacility = LOG_USER
#allowscp
allowsftp
#allowcvs
#allowrdist
#allowrsync
user=test007:022:00010:"/srv/test007"
O Genie, der Herr ehre dein Ego!
Lösche mal den rssh_chroot_helper aus den Chroots raus. Der wird zwar mitkopiert, hat da aber soviel ich weiß nichts verloren. (Unter Umständen ist dies sogar eine Sicherheitslücke, wenn er in den Chroots mit SETUID Bit ist)
Es sieht so aus als hätte dein /usr/lib/rssh/rssh_chroot_helper (außerhalb des Chroots!!!) kein SETUID Bit gesetzt. Dann ist er natürlich nicht in der Lage ins Chroot zu switchen.
In deiner /etc/rssh.conf fehlt außerdem der Chrootpath, ich bin mir nicht sicher, ob man den setzen muss, schaden kann es nicht.
chrootpath = /srv
Edit: Die Anführungszeichen um das Chrootdirectory bei deinem User kannst du weglassen., geht aber auch mit.
Edit2:
nicht vergessen, sonst hast du kein Verzeichnis, in das du schreiben darfst
Es sieht so aus als hätte dein /usr/lib/rssh/rssh_chroot_helper (außerhalb des Chroots!!!) kein SETUID Bit gesetzt. Dann ist er natürlich nicht in der Lage ins Chroot zu switchen.
Code: Alles auswählen
# ls -la /usr/lib/rssh/rssh_chroot_helper
-rwsr-xr-x 1 root root 19412 2007-02-16 05:39 /usr/lib/rssh/rssh_chroot_helper
chrootpath = /srv
Edit: Die Anführungszeichen um das Chrootdirectory bei deinem User kannst du weglassen., geht aber auch mit.
Edit2:
Code: Alles auswählen
mkdir /srv/test007/incoming
chown user:group /srv/test007/incoming
chmod 755 /srv/test007/incoming
hab den rssh_chroot_helper aus der chroot-umgebung gelöscht.
den rssh_chroot_helper im system (/usr/lib/rssh/rssh_chroot_helper) hab ich mit chmod 4755 auf SETUID root gesetzt.
geht aber leider nachwievor nicht... an den meldungen in syslog und auth.log hat sich nichts geändert.
kannst du vll mal ein ls -laR deines chroots anhängen?
edit: incoming verzeichnis hab ich auch mal erstellt. sollte aber mit dem problem an sich nichts zu tun haben
edit2: chrootpath braucht man nicht extra definieren, da der dann global gilt. deswegen ja beim user der eigene chroot... habs aber auch mal getestet. unverändert
den rssh_chroot_helper im system (/usr/lib/rssh/rssh_chroot_helper) hab ich mit chmod 4755 auf SETUID root gesetzt.
geht aber leider nachwievor nicht... an den meldungen in syslog und auth.log hat sich nichts geändert.
kannst du vll mal ein ls -laR deines chroots anhängen?
edit: incoming verzeichnis hab ich auch mal erstellt. sollte aber mit dem problem an sich nichts zu tun haben
edit2: chrootpath braucht man nicht extra definieren, da der dann global gilt. deswegen ja beim user der eigene chroot... habs aber auch mal getestet. unverändert
O Genie, der Herr ehre dein Ego!
Klaro:
/etc/rssh.conf
Ausschnitt aus /etc/passwd
/var/www/vhosts/legendz/etc/passwd
Edit: Ganz blöde Frage, hast du dein WinSCP auf SFTP gestellt, denn SCP wird von RSSH nicht unterstützt
Code: Alles auswählen
# ls -laR legendz/
legendz/:
total 7
drwxr-xr-x 7 root root 1024 2007-05-21 14:47 .
drwxr-xr-x 5 root root 1024 2007-05-21 23:13 ..
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 dev
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 etc
drwxr-xr-x 3 legendz www-data 1024 2007-05-21 14:50 home
drwxr-xr-x 3 root root 1024 2007-05-21 14:46 lib
drwxr-xr-x 4 root root 1024 2007-05-21 14:32 usr
legendz/dev:
total 2
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 7 root root 1024 2007-05-21 14:47 ..
crw-rw-rw- 1 root root 1, 3 2007-05-21 14:32 null
legendz/etc:
total 21
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 7 root root 1024 2007-05-21 14:47 ..
-rw-r--r-- 1 root root 12792 2007-05-21 14:32 ld.so.cache
-rw-r--r-- 1 root root 33 2007-05-21 14:32 ld.so.conf
-rw-r--r-- 1 root root 19 2007-05-21 14:32 ld.so.hwcappkgs
-rw-r--r-- 1 root root 465 2007-05-21 14:32 nsswitch.conf
-rw-r--r-- 1 root root 1107 2007-05-21 14:32 passwd
legendz/home:
total 3
drwxr-xr-x 3 legendz www-data 1024 2007-05-21 14:50 .
drwxr-xr-x 7 root root 1024 2007-05-21 14:47 ..
legendz/lib:
total 159
drwxr-xr-x 3 root root 1024 2007-05-21 14:46 .
drwxr-xr-x 7 root root 1024 2007-05-21 14:47 ..
-rwxr-xr-x 1 root root 88164 2007-05-21 22:41 ld-linux.so.2
-rw-r--r-- 1 root root 5820 2007-05-21 14:32 libcom_err.so.2
-rw-r--r-- 1 root root 26332 2007-02-21 16:13 libnss_compat-2.3.6.so
lrwxrwxrwx 1 root root 22 2007-05-21 14:32 libnss_compat.so.2 -> libnss_compat-2.3.6.so
-rw-r--r-- 1 root root 34276 2007-02-21 16:13 libnss_files-2.3.6.so
lrwxrwxrwx 1 root root 21 2007-05-21 14:32 libnss_files.so.2 -> libnss_files-2.3.6.so
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 tls
legendz/lib/tls:
total 1407
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 3 root root 1024 2007-05-21 14:46 ..
-rw-r--r-- 1 root root 21868 2007-05-21 14:32 libcrypt.so.1
-rw-r--r-- 1 root root 1241392 2007-05-21 14:32 libc.so.6
-rw-r--r-- 1 root root 9592 2007-05-21 14:32 libdl.so.2
-rw-r--r-- 1 root root 76548 2007-05-21 14:32 libnsl.so.1
-rw-r--r-- 1 root root 67364 2007-05-21 14:32 libresolv.so.2
-rw-r--r-- 1 root root 9656 2007-05-21 14:32 libutil.so.1
legendz/usr:
total 4
drwxr-xr-x 4 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 7 root root 1024 2007-05-21 14:47 ..
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 bin
drwxr-xr-x 5 root root 1024 2007-05-21 14:32 lib
legendz/usr/bin:
total 67
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 4 root root 1024 2007-05-21 14:32 ..
-rwxr-xr-x 1 root root 20100 2007-05-21 14:32 rssh
-rwxr-xr-x 1 root root 43600 2007-05-21 14:32 scp
legendz/usr/lib:
total 859
drwxr-xr-x 5 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 4 root root 1024 2007-05-21 14:32 ..
drwxr-xr-x 3 root root 1024 2007-05-21 14:32 i686
-rw-r--r-- 1 root root 111708 2007-05-21 14:32 libgssapi_krb5.so.2
-rw-r--r-- 1 root root 151252 2007-05-21 14:32 libk5crypto.so.3
-rw-r--r-- 1 root root 508328 2007-05-21 14:32 libkrb5.so.3
-rw-r--r-- 1 root root 14504 2007-05-21 14:32 libkrb5support.so.0
-rw-r--r-- 1 root root 78500 2007-05-21 14:32 libz.so.1
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 openssh
drwxr-xr-x 2 root root 1024 2007-05-23 20:57 rssh
legendz/usr/lib/i686:
total 3
drwxr-xr-x 3 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 5 root root 1024 2007-05-21 14:32 ..
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 cmov
legendz/usr/lib/i686/cmov:
total 1254
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 3 root root 1024 2007-05-21 14:32 ..
-rw-r--r-- 1 root root 1275032 2007-05-21 14:32 libcrypto.so.0.9.8
legendz/usr/lib/openssh:
total 39
drwxr-xr-x 2 root root 1024 2007-05-21 14:32 .
drwxr-xr-x 5 root root 1024 2007-05-21 14:32 ..
-rwxr-xr-x 1 root root 36280 2007-05-21 14:32 sftp-server
legendz/usr/lib/rssh:
total 2
drwxr-xr-x 2 root root 1024 2007-05-23 20:57 .
drwxr-xr-x 5 root root 1024 2007-05-21 14:32 ..
Code: Alles auswählen
# This is the default rssh config file
# set the log facility. "LOG_USER" and "user" are equivalent.
logfacility = LOG_USER
# Leave these all commented out to make the default action for rssh to lock
# users out completely...
#allowscp
allowsftp
#allowcvs
#allowrdist
#allowrsync
# set the default umask
umask = 022
# If you want to chroot users, use this to set the directory where the root of
# the chroot jail will be located.
#
# if you DO NOT want to chroot users, LEAVE THIS COMMENTED OUT.
chrootpath = /var/www/vhosts
user=legendz:027:00010:/var/www/vhosts/legendz
Code: Alles auswählen
legendz:x:1000:33::/var/www/vhosts/legendz:/usr/bin/rssh
Code: Alles auswählen
legendz:x:1000:33::/var/www/vhosts/legendz:/usr/bin/rssh
lol, klar steht das auf SFTP. Habs aber auch lokal auf der konsole und mit Filezille probiert... selbes problem.
bitte häng mir noch ein
an. danke.
bitte häng mir noch ein
Code: Alles auswählen
rssh -v
O Genie, der Herr ehre dein Ego!
Code: Alles auswählen
# rssh -v
rssh 2.3.2
Copyright 2002-5 Derek D. Martin <rssh-discuss at lists dot sourceforge dot net>
rssh config file = /etc/rssh.conf
chroot helper path = /usr/lib/rssh/rssh_chroot_helper
scp binary path = /usr/bin/scp
sftp server binary = /usr/lib/openssh/sftp-server
cvs binary path = /usr/bin/cvs
rdist binary path = /usr/bin/rdist
rsync binary path = /usr/bin/rsync
Hier noch die Logeinträge bei einem Connect, dann solltest du wirklich _alles_ haben
Code: Alles auswählen
May 23 21:24:52 sshd[15805]: Accepted password for legendz from 0.0.0.0 port 3924 ssh2
May 23 21:24:52 sshd[15808]: (pam_unix) session opened for user legendz by (uid=0)
May 23 21:24:52 sshd[15808]: subsystem request for sftp
May 23 21:24:52 rssh[15809]: setting log facility to LOG_USER
May 23 21:24:52 rssh[15809]: chroot cmd line: /usr/lib/rssh/rssh_chroot_helper 2 "/usr/lib/openssh/sftp-server"
May 23 21:24:55 sshd[15808]: (pam_unix) session closed for user legendz
ok, ich nehme an du hast ein etch am laufen?
jedenfalls hab ich das alles nun 1:1 kopiert.... und es hat sich was getan.
funktioniert zwar nachwievor nicht... aber immerhin.
Auszug /var/log/syslog
Die Zeile mit ">>>" am Anfang macht mir Sorgen... was könnte das sein?
Auszug /var/log/auth.log
ich bin mit meinem spanisch echt am ende...
jedenfalls hab ich das alles nun 1:1 kopiert.... und es hat sich was getan.
funktioniert zwar nachwievor nicht... aber immerhin.
Auszug /var/log/syslog
Code: Alles auswählen
May 23 21:45:42 localhost rssh[27630]: setting log facility to LOG_USER
May 23 21:45:42 localhost rssh[27630]: allowing sftp to all users
May 23 21:45:42 localhost rssh[27630]: line 21: configuring user test007
May 23 21:45:42 localhost rssh[27630]: setting test007's umask to 022
May 23 21:45:42 localhost rssh[27630]: allowing sftp to user test007
May 23 21:45:42 localhost rssh[27630]: chrooting test007 to /srv/test007
May 23 21:45:42 localhost rssh[27630]: chroot cmd line: /usr/lib/rssh/rssh_chroot_helper 2 "/usr/lib/openssh/sftp-server"
May 23 19:45:42 localhost rssh_chroot_helper[27630]: new session for test007, UID=1302
May 23 19:45:42 localhost rssh_chroot_helper[27630]: user's home dir is /srv/test007
>>> May 23 19:45:42 localhost rssh_chroot_helper[27630]: couldn't find /srv/test007 in chroot jail
May 23 19:45:42 localhost rssh_chroot_helper[27630]: chrooted to /srv/test007
May 23 19:45:42 localhost rssh_chroot_helper[27630]: changing working directory to / (inside jail)
Auszug /var/log/auth.log
Code: Alles auswählen
May 23 21:45:42 localhost sshd[27626]: Accepted password for test007 from xxx.xxx.xxx.xxx port 63872 ssh2
May 23 21:45:42 localhost sshd[27629]: (pam_unix) session opened for user test007 by (uid=0)
May 23 21:45:42 localhost sshd[27629]: subsystem request for sftp
May 23 21:45:42 localhost sshd[27629]: (pam_unix) session closed for user test007
O Genie, der Herr ehre dein Ego!
ich hab das nun nochmal 1:1 so auf meiner lokalen testbox installiert.... und siehe da, es FUNZT!
ich würde echt gerne wissen was auf der anderen kiste falsch konfiguriert ist....
EDIT: wenn ich den chroot beim user weglasse, also ohne chroot, dann funzt rssh einwandfrei.... versteh ich aber ned weil, wiegesagt, die chroot 1:1 exakt wie auf meiner testbox aussieht... ich könnte heulen echt
ich würde echt gerne wissen was auf der anderen kiste falsch konfiguriert ist....
EDIT: wenn ich den chroot beim user weglasse, also ohne chroot, dann funzt rssh einwandfrei.... versteh ich aber ned weil, wiegesagt, die chroot 1:1 exakt wie auf meiner testbox aussieht... ich könnte heulen echt
O Genie, der Herr ehre dein Ego!
es funktioniert nun....
aber warum, KEINE AHNUNG
ich hab einfach den user test007 gelöscht, ihn nochmal erstellt unter neuem namen: testuser
dann hab ich es wieder probiert, ging nicht.
dann hab ich ihn, siehe einen beitrag vorher, mal nicht in eine chroot eingesperrt. das ging dann...
wieder im chroot, gings nicht mehr.
dann hab ich ihm mal scp und sftp erlaubt, ging wieder nicht....
anschließend hab ich google.de heftig penetriert um eine lösung zu finden... und siehe da, ne halbe stunde später wieder probiert und nun gehts.... ich versteh die welt nicht mehr
hab die config nochmal überprüft, er ist definitv im chroot eingesperrt und hat nur sftp-rechte... komische sache lol
aber warum, KEINE AHNUNG
ich hab einfach den user test007 gelöscht, ihn nochmal erstellt unter neuem namen: testuser
dann hab ich es wieder probiert, ging nicht.
dann hab ich ihn, siehe einen beitrag vorher, mal nicht in eine chroot eingesperrt. das ging dann...
wieder im chroot, gings nicht mehr.
dann hab ich ihm mal scp und sftp erlaubt, ging wieder nicht....
anschließend hab ich google.de heftig penetriert um eine lösung zu finden... und siehe da, ne halbe stunde später wieder probiert und nun gehts.... ich versteh die welt nicht mehr
hab die config nochmal überprüft, er ist definitv im chroot eingesperrt und hat nur sftp-rechte... komische sache lol
O Genie, der Herr ehre dein Ego!
nein, der helper ist nicht innerhalb des chroots.
und außerhalb eben mit SETUID root
chroot sieht genau wie bei dir aus, inkl. rechte.
Version ist die von etch, aber dennoch selbe wie bei dir. Wurde anscheinend schon länger am Packet nichts mehr verändert...
ich versteh halt nicht, warum es, ohne eine änderung, eine halbe stunde später magischer weise auf einmal funktioniert
und außerhalb eben mit SETUID root
chroot sieht genau wie bei dir aus, inkl. rechte.
Version ist die von etch, aber dennoch selbe wie bei dir. Wurde anscheinend schon länger am Packet nichts mehr verändert...
ich versteh halt nicht, warum es, ohne eine änderung, eine halbe stunde später magischer weise auf einmal funktioniert
O Genie, der Herr ehre dein Ego!