SFTP-Server: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K (Linkai.zhang verschob die Seite Sftp-server nach SFTP-Server, ohne dabei eine Weiterleitung anzulegen) |
|||
| Zeile 1: | Zeile 1: | ||
[[Kategorie:SSH]] | [[Kategorie:SSH]] | ||
| − | = | + | = Benutzer und Heimatverzeichnis anlegen = |
| − | *mkdir / | + | *'''mkdir -pv /srv/sftp/''' |
| − | *groupadd sftponly | + | *'''groupadd sftponly''' |
| − | *useradd -G sftponly -d / | + | *'''useradd -G sftponly -d /srv/sftp/gast -s /bin/false gast''' |
| − | *mkdir -p / | + | *'''mkdir -p /srv/sftp/gast/ablage''' |
| − | *chown gast / | + | *'''chown gast:gast /srv/sftp/gast/ablage''' |
| − | *passwd gast | + | *'''passwd gast''' |
= SSH Server Konfiguration = | = SSH Server Konfiguration = | ||
| Zeile 15: | Zeile 15: | ||
UsePAM yes | UsePAM yes | ||
Match Group sftponly | Match Group sftponly | ||
| − | ChrootDirectory / | + | ChrootDirectory /srv/sftp/%u |
ForceCommand internal-sftp | ForceCommand internal-sftp | ||
| + | PasswordAuthentication yes | ||
AllowTcpForwarding no | AllowTcpForwarding no | ||
</pre> | </pre> | ||
Version vom 16. September 2024, 20:29 Uhr
Benutzer und Heimatverzeichnis anlegen
- mkdir -pv /srv/sftp/
- groupadd sftponly
- useradd -G sftponly -d /srv/sftp/gast -s /bin/false gast
- mkdir -p /srv/sftp/gast/ablage
- chown gast:gast /srv/sftp/gast/ablage
- passwd gast
SSH Server Konfiguration
- Suchen Sie nach der Zeile Subsystem und ergänzen sie die folgenden Zeilen.
- cat /etc/ssh/sshd_config
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
Match Group sftponly
ChrootDirectory /srv/sftp/%u
ForceCommand internal-sftp
PasswordAuthentication yes
AllowTcpForwarding no
Angemeldete Benutzer anzeigen
- ps -ef | grep '[s]shd:.*@notty' | grep -v ^root
- notty, da SFTP-Benutzer kein Terminal haben wie per SSH angemeldete Benutzer