Sftp-server: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
(2 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
=User und Home-Dir anlegen=
 
=User und Home-Dir anlegen=
 
<source lang=bash>
 
<source lang=bash>
 +
root@ricky:~# mkdir /users/
 
root@ricky:~# groupadd sftponly
 
root@ricky:~# groupadd sftponly
root@ricky:~# useradd -G sftponly -s /bin/false trial
+
root@ricky:~# useradd -G sftponly -d /users/anton -s /bin/false anton
root@ricky:~# mkdir /home/trial
+
root@ricky:~# mkdir -p /users/anton/ablage
root@ricky:~# mkdir /home/trial/ablage
+
root@ricky:~# chown anton /users/anton/ablage
root@ricky:~# chown triaz /home/trial/ablage
 
 
</source>
 
</source>
 +
 
=config=
 
=config=
 
*/etc/ssh/sshd.conf
 
*/etc/ssh/sshd.conf
Zeile 13: Zeile 14:
 
UsePAM yes
 
UsePAM yes
 
Match Group sftponly
 
Match Group sftponly
         ChrootDirectory /home/%u
+
         ChrootDirectory /users/%u
 
         ForceCommand internal-sftp
 
         ForceCommand internal-sftp
 
         AllowTcpForwarding no
 
         AllowTcpForwarding no

Version vom 2. Oktober 2018, 13:59 Uhr

User und Home-Dir anlegen

root@ricky:~# mkdir /users/
root@ricky:~# groupadd sftponly
root@ricky:~# useradd -G sftponly -d /users/anton -s /bin/false anton
root@ricky:~# mkdir -p /users/anton/ablage
root@ricky:~# chown anton /users/anton/ablage

config

  • /etc/ssh/sshd.conf
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
Match Group sftponly
        ChrootDirectory /users/%u
        ForceCommand internal-sftp
        AllowTcpForwarding no

Links