Salut tout le monde !
Merci pour ce tuto ! Mais j'ai un petit problème maintenant 😀.
J'ai changer mon accès SSH. Donc maintenant j'y accède avec un nouveau login et un autre port. Le problème c'est que je ne peux plus modifier les fichier en SFTP avec mon nouvelle accès.
En essayant de résoudre le problème, j'ai fait des modifs et je ne peux plus accéder en SFTP avec mes autres users.
voici mon fichier de config SSH :
# What ports, IPs and protocols we listen for
Port <monport>
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
#PermitRootLogin without-password
PermitRootLogin no
StrictModes yes
AllowUsers <loginSSH> <users1> <users2> <users3>
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
PermitEmptyPasswords no
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 internal-sftp
Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
Match User <users1>
ChrootDirectory /home/<users1>
Match User <users2>
ChrootDirectory /home/<users2>
Match User <users3>
ChrootDirectory /home/<users3>
Dans mes modifs j'ai essayer de faire :
chown -R <monloginSSH> /home/ <monloginSSH>
chown -R <monloginSSH> /
Match User <monloginSSH>
ChrootDirectory /home/<monloginSSH> ...
Mais comme je le disais maintenant, je ne peux plus accéder par SFTP avec mes users mais uniquement avec <monloginSSH>.
Par contre si je retire :
Match User <users1>
ChrootDirectory /home/<users1>
Match User <users2>
ChrootDirectory /home/<users2>
Match User <users3>
ChrootDirectory /home/<users3>
la connexion SFTP fonctionne mais du coup ils peuvent accéder au serveur entier...
Merci pour votre aide.
EDIT : j'ai essayer ça en vain ...
chown -R <username>:<username> /home/<username>
chown root:<username> /home/<username>
chmod 755 /home/<username>