SFTP: Nutzer in Verzeichnis einsperren

pinki

Cadet 1st Year
Registriert
März 2009
Beiträge
14
Moin moin!
Ich möchte verschiedene SFTP-Nutzer jeweils in verschiedene Verzeichnisse "einsperren".
Wenn möglich sollen die Nutzer nur per SFTP darauf kommen, jedoch nicht per SSH.

Kann mit jemand sagen, wie ich das anstellen kann?

Betriebssystem ist Ubuntu 9.04 Server Edition und der SSH-Server ist der mitgelieferte Server.


Gruß
pinki
 
man sshd_config hilft:

Chroot:

Code:
ChrootDirectory
             Specifies a path to chroot(2) to after authentication.


Nur SFTP:

Code:
ForceCommand
             Forces the execution of the command specified by ForceCommand,
             ignoring any command supplied by the client and ~/.ssh/rc if pre-
             sent.  The command is invoked by using the user's login shell
             with the -c option.  This applies to shell, command, or subsystem
             execution.  It is most useful inside a Match block.  The command
             originally supplied by the client is available in the
             SSH_ORIGINAL_COMMAND environment variable.  [B]Specifying a command
             of ``internal-sftp'' will force the use of an in-process sftp
             server that requires no support files when used with
             ChrootDirectory.[/B]


Beispielkonfiguration für Gruppe 'web':

Code:
Match group web
	ChrootDirectory /home/%u
	X11Forwarding no
	AllowTcpForwarding no
	ForceCommand internal-sftp



edit: hier gehts weniger um 'Heimnetzwerke', sondern eher um Linux Administration.
 
K. Dann habe ich das Forum wohl falsch gewählt. Entschuldige bitte.

Sobald ich ForceCommand internal-sftp und ChrootDirectory /home/newuser in die Konfigurationsdatei schreibe, komme ich nicht mehr auf den Server. Wenn ich ForceCommand internal-sftp weglasse, komme ich auch nicht per sftp auf den Server.
 
Wie du kommst nicht mehr auf den Server? Per SSH oder SFTP?

Der Sinn der Sache war ja, nur mehr SFTP zuzulassen und den User zu chrooten.
 
Habe ich auch schon versucht. Geht auch nicht. :(

Ich habe gerade einen Artikel über scponly (den hier) gefunden.
Das scheint die Benutzer nur in ihr Homedir zu chrooten, aber den Rest kann man ja in Unterverzeichnisse mounten. Mal sehen, ob das zum gewünschten Ergebnis führt.
 
Was steht in den logs (/var/log/auth.log)?


Achte auch auf die Berechtigungen des Ordners:

Code:
ChrootDirectory
             Specifies a path to chroot(2) to after authentication.  [B]This
             path, and all its components, must be root-owned directories that
             are not writable by any other user or group.[/B] After the chroot,
             sshd(8) changes the working directory to the user's home directo-
             ry.


Versuche es lieber mit direkt mit OpenSSH, als durch irgendwelche komischen Skripts.
 
Zurück
Oben