StefanKonarski.de - fusefs https://stefankonarski.de/category/tags/fusefs de Verschlüsseltes Netzwerkdateisystem SSHFS unter FreeBSD https://stefankonarski.de/content/verschluesseltes-netzwerkdateisystem-sshfs-unter-freebsd <div class="field field-name-taxonomy-vocabulary-3 field-type-taxonomy-term-reference field-label-above"> <div class="field-items"> <div class="field-item even"><a href="/category/tags/services">Dienste</a></div> <div class="field-item odd"><a href="/category/tags/freebsd">FreeBSD</a></div> <div class="field-item even"><a href="/category/tags/werkzeuge">Werkzeuge</a></div> <div class="field-item odd"><a href="/category/tags/ssh">SSH</a></div> <div class="field-item even"><a href="/category/tags/fusefs">fusefs</a></div> </div> </div> <div class="field field-name-body field-type-text-with-summary field-label-hidden"> <div class="field-items"> <div class="field-item even"><p>Wenn NFS nicht in Frage kommt, lassen sich entfernte Dateisysteme via sshfs unter FreeBSD (natürlich auch unter anderen Betriebssystemen) einbinden.</p> <!--break--> <p>Voraussetzung natürlich: Auf dem entfernten Rechner muss ein ssh-Dämon laufen. Der Port sysutils/fusefs-sshfs ist auf dem lokalen Rechner schnell installiert. </p> <h2>Vorbereitung</h2> <p>Für sshfs wird fuse benötigt. Dieser Port, sowie das Kernel-Modul sollte also schon installiert sein. In die /etc/rc.conf nun folgende Zeile einfügen:</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">fusefs_enable=&quot;YES&quot; </div></li></ol></pre></div> <p>Der Dienste muss natürlich jetzt noch auf dem üblichen Weg gestartet werden. Bei Problemen mit dem Kernel Modul lohnt es sich, den Port sysutils/fusefs-kmod neu zu bauen. Will man sshfs als normaler User nutzen, fehlt vielleicht noch</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"># sysctl vfs.usermount=1</div></li></ol></pre></div> <p>Permanent wird dieser Eintrag mit der folgenden Zeile in der Datei /etc/sysctl.conf</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">vfs.usermount=1</div></li></ol></pre></div> <p>Als letzten fehlen für einen normalen User noch die Rechte für das Device /dev/fuse0. Wenn man alle User, die Lese- und Schreibrechte haben dürfen, der Gruppe operator zufügt, ist dies erledigt. <br /> Es gibt nun 2 Wege, ein entferntes Verzeichnis einzubinden:</p> <h2>1. sshfs als normaler Benutzer</h2> <p>Voraussetzung: Auf dem entfernten Rechner steht ein Account zur Verfügung. Dann kann man mit der allgemeinen Befehlszeile</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">sshfs -o idmap=user username@example.org:/path /path/to/mount/point</div></li></ol></pre></div> <p>also z.B.</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">$ mkdir ~/mnt</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">$ sshfs -o idmap=user username@example.org:/usr/local/www ~/mnt</div></li></ol></pre></div> <p>Nach Eingabe des Passworts ist das entfernte Verzeichnis via ssh gemountet.</p> <h2>2. sshfs als root via mount_fusefs</h2> <p>Als root mit der Zeile</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">mount_fusefs auto /path/to/mount/point sshfs -o idmap=user username@example.org:</div></li></ol></pre></div> <p>Also z.B.</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"># mount_fusefs auto /mnt sshfs -o idmap=user username@example.org:</div></li></ol></pre></div> <h2>Fehlermeldungen</h2> <p>Es empfiehlt sich vor dem Mounten einmal den Anmeldeprozess durchzuführen:</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"># ssh username@example.org</div></li></ol></pre></div> <p>damit der Schlüssel der Liste der bekannten Hosts hinzugefügt werden kann. Der mount-Befehl kann diesen Schritt nicht durchführen.</p> <p>Beim Versuch mount_fusefs als root auszuführen und auf das User-Verzeichnis auf dem entfernten Rechner zuzugreifen, kann folgendes Fehlerbild erscheinen:</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"># mount_fusefs auto /mnt sshfs -o sshfs_debug,idmap=user username@example.org:</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"># SSHFS version 2.2</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">Password:</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">Password:</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">Password:</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">remote host has disconnected</div></li></ol></pre></div> <p>ohne dass man die Möglichkeit hat, ein Kennwort einzugeben. Auf dem entfernten Rechner steht in /var/log/messages:</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal">sshd[19152]: error: PAM: authentication error for username from XXX.XXX.XXX.XXX</div></li></ol></pre></div> <p>Dies kann umgangen werden, indem man mit ssh-keygen ein Schlüsselpaar erzeugt und den öffentlichen Schlüssel auf den entfernten Rechner kopiert, z.B. als root mit</p> <div class="geshifilter"><pre class="text geshifilter-text" style="font-family:monospace;"><ol><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"># ssh-keygen</div></li><li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"># cat /root/.ssh/id_rsa.pub | ssh username@example.org 'cat &gt;&gt; .ssh/authorized_keys'</div></li></ol></pre></div> <p>Das setzt natürlich voraus, dass im Homedirectory des Users das Verzeichnis .ssh existiert.</p> <p>Weitere Fehlerquellen:</p> <ul> <li>/dev/null hat nicht die Rechte 0666 </li> <li>Auf dem entfernten Rechner ist in der sshd_config das sftp Subsystem deaktiviert</li> <li>Auf dem entfernten Rechner ist in der sshd_config UsePAM deaktiviert</li> </ul></div> </div> </div> Fri, 26 Mar 2010 15:49:35 +0000 stefan 153 at https://stefankonarski.de https://stefankonarski.de/content/verschluesseltes-netzwerkdateisystem-sshfs-unter-freebsd#comments WebDAV https://stefankonarski.de/content/webdav <div class="field field-name-taxonomy-vocabulary-3 field-type-taxonomy-term-reference field-label-above"> <div class="field-items"> <div class="field-item even"><a href="/category/tags/administration">Administration</a></div> <div class="field-item odd"><a href="/category/tags/services">Dienste</a></div> <div class="field-item even"><a href="/category/tags/werkzeuge">Werkzeuge</a></div> <div class="field-item odd"><a href="/category/tags/www">WWW</a></div> <div class="field-item even"><a href="/category/tags/fusefs">fusefs</a></div> </div> </div> <div class="field field-name-body field-type-text-with-summary field-label-hidden"> <div class="field-items"> <div class="field-item even"><p>Richtet man WebDAV auf einem Webserver ein, so k&ouml;nnen Nutzer oder Gruppen lesend und auch schreibend auf freigegebene Verzeichnisse zugreifen. Da dieser Standard frei ist, ist dies mit allen g&auml;ngigen Betriebssystemen m&ouml;glich. Da der Webserver die Schreibzugriffe verwaltet ist dies in verschiedener Hinsicht vorteilhaft.</p> <!--break--> <ul> <li>Es werden nur die Standardports 80, bzw 443 f&uuml;r eine verschl&uuml;sselte Verbindung ben&ouml;tigt. Diese sind in den meisten Firewalls (im Gegensatz zu FTP oder SSH) ge&ouml;ffnet</li> <li>Die Dateien werden mit den Zugriffsrechten des Users geschrieben, unter dem der Webserver l&auml;uft (beispielsweise die Rollen www oder www-data). Im Gegensatz zu FTP&nbsp;gibt es kein Rechte-Probleme mit verschiedenen Usern.</li> </ul> <p>&nbsp;Unter FreeBSD l&auml;&szlig;t sich ein WebDAV-Verzeichnis mit dem Tool <tt class="path">fusefs-wdfs</tt> mounten:</p> <p>portinstall <tt class="path">fusefs-wdfs</tt></p> <p><tt class="path">In /etc/rc.conf:</tt><br /> fusefs_enable=&quot;YES&quot;</p> <p>Dann kann fusefs gestartet werden:<br /> /usr/local/etc/rc.d/fusefs start</p> <p>Sobald Fuse gestartet ist l&auml;sst sich mit folgenden Kommandos WebDav Laufwerke mounten:</p> <p>#mkdir ~/webdav<br /> #wdfs <a href="http://example.com/davdir" class="external free" title="http://ServerNameOderIpAdresse/davdir" rel="nofollow">http://example.com/davdir</a> ~/webdav</p> <p>Anstelle des FQDN example.com kann man natürlich auch die IP nutzen oder alles andere, z.B. einen Eintrag aus hosts.</p></div> </div> </div> Sun, 30 Aug 2009 09:39:30 +0000 stefan 23 at https://stefankonarski.de https://stefankonarski.de/content/webdav#comments