Skip to main content

SSHFS

Umgezogene User

Username
Backup SK
Crontab
Status Info
Little-Snitch-5853-e818-c249-808

Fertig Laptop MKP





V24_NextCloud

Fertig
NextCloud
V25_Vaultwarden True
True
Fertig
Vaultwarden



































useradd -M -s /bin/bash -G sshfsusers OTTO_MÜLLER_123

🔐 SSHFS-Mount Anleitung für Linux + Nextcloud

1. SSH-Schlüssel erstellen (auf dem Client)

ssh-keygen -t ed25519 -f ~/.ssh/V24_NextCloud -C "V24_NextCloud on ThinkStation__S4AKHKX__big-bunda"
ssh-keygen -t ed25519 -f /root/.ssh/ -C " on ThinkStation__S4AKHKX__big-bunda"

2. Öffentlichen Schlüssel auf den Server übertragen

scp ~/.ssh/V24_NextCloud.pub root@server:/etc/sshfs_keys/V24_NextCloud.pub
chmod 644 /etc/sshfs_keys/V24_NextCloud.pub

3. Benutzer auf dem Server anlegen (sicher für SSHFS)

useradd -M -s /bin/bash -G sshfsusers V24_NextCloud
mkdir -p /mnt/sshfs/V24_NextCloud
chown V24_NextCloud:V24_NextCloud /mnt/sshfs/V24_NextCloud

# Optionale Dummy-Shell für mehr Sicherheit:
echo -e '#!/bin/bash\nexit 0' > /usr/local/bin/sshfs-dummy
chmod +x /usr/local/bin/sshfs-dummy
usermod -s /usr/local/bin/sshfs-dummy V24_NextCloud

4. SSH-Konfiguration (angepasst für SSHFS)

# /etc/ssh/sshd_config
Match User V24_NextCloud
    AuthorizedKeysFile /etc/sshfs_keys/%u.pub
    AllowTcpForwarding no
    X11Forwarding no
    PermitTTY yes
    # Kein ForceCommand setzen, da SSHFS sonst blockiert würde
systemctl reload sshd

5. SSHFS-Mount auf dem Client

sshfs -o IdentityFile=~/.ssh/V24_NextCloud \
      -o reconnect \
      -o ServerAliveInterval=15 \
      -o ServerAliveCountMax=3 \
      -o allow_other \
      -o uid=1000 \
      -o gid=1000 \
      -o umask=002 \
      -o idmap=user \
      V24_NextCloud@server:/mnt/sshfs/V24_NextCloud /mnt/V24_NextCloud

💡 Hinweis:

  • /etc/fuse.conf: Stelle sicher, dass user_allow_other nicht auskommentiert ist
  • uid und gid auf deinen lokalen User anpassen (z. B. id benutzername)
  • Mit umask=002 erhält Gruppe vollen Zugriff (770)

🎁 Bonus: Nutzung mit Nextcloud

Mount für www-data (Nextcloud)

sshfs -o IdentityFile=~/.ssh/nextcloud_key \
      -o reconnect \
      -o ServerAliveInterval=15 \
      -o ServerAliveCountMax=3 \
      -o allow_other \
      -o uid=33 \
      -o gid=33 \
      -o umask=007 \
      -o idmap=user \
      nextcloud@server:/mnt/sshfs/nextcloud /mnt/nextcloud_data

Wichtig:

  • uid=33 und gid=33 = Benutzer www-data (standardmäßig)
  • Pfad /mnt/nextcloud_data muss für Nextcloud erreichbar sein
  • In Nextcloud → Admin → Externer Speicher hinzufügen

Optional für Dauerbetrieb:

Systemd-Mount oder /etc/fstab verwenden, z. B.:

sshfs#nextcloud@server:/mnt/sshfs/nextcloud /mnt/nextcloud_data fuse.sshfs \
IdentityFile=/root/.ssh/nextcloud_key,allow_other,uid=33,gid=33,umask=007,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,idmap=user 0 0

🙋‍♂️ Hilfe für Mehrbenutzer-Zugriff unter Linux

  • Verwende -o allow_other, um auch anderen lokalen Usern Zugriff zu erlauben
  • Nutze uid= und gid=, um das Mount für bestimmte Benutzer oder Gruppen bereitzustellen
  • Beispiel für Gruppe medien:
    -o allow_other,uid=1000,gid=1002,umask=007
  • Tipp: Passe Gruppenrechte lokal an, z. B. mit usermod -aG medien benutzername