Sftp-server: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
(4 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
 
+
=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 triaz
+
root@ricky:~# useradd -G sftponly -d /users/anton -s /bin/false anton
root@ricky:~# mkdir /home/triaz
+
root@ricky:~# mkdir -p /users/anton/ablage
root@ricky:~# mkdir /home/triaz/ablage
+
root@ricky:~# chown anton /users/anton/ablage
root@ricky:~# chown triaz /home/triaz/ablage
 
 
</source>
 
</source>
 +
 +
=config=
 +
*/etc/ssh/sshd.conf
 +
<pre>
 +
Subsystem sftp /usr/lib/openssh/sftp-server
 +
UsePAM yes
 +
Match Group sftponly
 +
        ChrootDirectory /users/%u
 +
        ForceCommand internal-sftp
 +
        AllowTcpForwarding no
 +
 +
</pre>
  
 
=Links=
 
=Links=
 
*[http://en.wikibooks.org/wiki/OpenSSH/Cookbook/SFTP#Chrooted_SFTP_to_Shared_Directories SFTP]
 
*[http://en.wikibooks.org/wiki/OpenSSH/Cookbook/SFTP#Chrooted_SFTP_to_Shared_Directories SFTP]

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