Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 11/12/2015, à 15:06

hunter1701

Aide configuration SFTP

Bonjour,

J'administre un serveur web basé sur Debian dans un établissement scolaire. Sur ce serveur il m'a été demandé de chrooter l'accès aux répertoires des différents projets pour éviter que les élèves n'aillent voir les projets des autres. Jusque là tout fonctionne bien, sauf que les comptes que j'ai créé pour accéder aux projets en question ne permettent pas de supprimer ni d'ajouter des fichiers aux répertoires ...

Voici mon sshd_config :

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

subsystem sftp internal-sftp

AllowUsers sin happycat mystation maidbot handyhouse root pierre

Match User sin
	ChrootDirectory /var/www/all/
	ForceCommand internal-sftp

Match User happycat
	ChrootDirectory /var/www/happycat/
	ForceCommand internal-sftp

Match User mystation
	ChrootDirectory /var/www/mystation/
	ForceCommand internal-sftp

Match User maidbot
	ChrootDirectory /var/www/maidbot/
	ForceCommand internal-sftp

Match User handyhouse
	ChrootDirectory /var/www/handyhouse/
	ForceCommand internal-sftp

Match User pierre
	ChrootDirectory /var/www/

Et voici les droits actuels de mes répertoires :

.
|-- [drwxr-xr-x root     root    ]  handyhouse
|   |-- [-rwxr-xr-x handyhou root    ]  handyhouse.test
|   `-- [-rwxr-xr-x handyhou root    ]  test.html

|-- [drwxr-xr-x root     root    ]  happycat

|-- [drwxr-xr-x root     root    ]  maidbot
|   |-- [-rwxr-xr-x maidbot  root    ]  maidbot.test
|   `-- [-rwxr-xr-x maidbot  root    ]  test.html

|-- [drwxr-xr-x root     root    ]  mystation
|   |-- [-rwxr-xr-x mystatio root    ]  mystation.test
|   `-- [-rwxr-xr-x mystatio root    ]  test.html

Dans l'état actuel les droits semblent correspondre au minimum syndical réclamé par SSH. Cependant, si je met en propriétaire quelqu'un d'autre que root (par exemple mystation pour le répertoire du même nom), un utilisateur déjà connecté pourra supprimer ou ajouter du contenu mais SSH refusera toutes les nouvelles tentatives de connexion ! Dans la mesure ou j'ai un utilisateur par répertoire et que ces utilisateurs existent sur le serveur (et appartiennent au groupe root), ma question est la suivante :

Quelqu'un aurait une idée de ce que je doit faire pour que mes utilisateurs aient le contrôle total du répertoire sans que cela pose de problème à SSH ?

Je vous remercie d'avance
-- Hunter

Dernière modification par hunter1701 (Le 11/12/2015, à 15:07)

Hors ligne

#2 Le 11/12/2015, à 16:30

cqfd93

Re : Aide configuration SFTP

Modération

Bonjour,

Puisque ton serveur est basé sur Debian (qui n'est pas une dérivée d'Ubuntu), il est préférable de poser cette question sur un de leurs forums qui sera probablement plus à même de t'aider (debian-fr et Debian-Facile).

Comme il est dit dans les règles du forum, une question ne concernant pas Ubuntu ou ses dérivées peut être posée dans le Café, donc je déplace ta question.


cqfd93

Hors ligne

#3 Le 11/12/2015, à 16:51

Compte anonymisé

Re : Aide configuration SFTP