z.B.:

sudo sshfs -C -p 22 -o uid=1000,gid=1000 raldiman@gerald.webhop.org:/var/daten /mnt/sshfs_dir 

sshfs

Quelle1)

SSH is protocol to transfer files securely. Like FTP, but more secure. Many hosting services offer their client the ability to remotely login to their hosting account using ssh. Transferring files to an from an ssh account can be done using the scp command. However, it would be neat if you could mount a remote folder that you can access using ssh on your local computer, so that you can access files on an ssh account just like they were local files on your pc, right? Well now you can! Mount a folder in an ssh account, edit the files locally and save the files, and the file on the ssh server changes too! Isn’t it awesome!!!

We will use sshfs to acheive our goal. The following guide will step you through the process of mouting file systems over ssh on Ubuntu 5.10 Breezy systems.

sshfs:
       sshfs  is  a filesystem client based on the SSH File Transfer Protocol.
       Since most SSH servers already support this protocol it is very easy to
       set  up:  i.e. on the server side there’s nothing to do.  On the client
       side mounting the filesystem is as easy as logging into the server with
       ssh.

Install sshfs by doing a:

$sudo apt-get install sshfs

This will also install fuse-utils and libfuse2, which are required.

Now, let us create a local directory where you want the files mounted. You should create the directory and make yourself the owner of the directory:

$sudo mkdir /media/dir-name
$sudo chown your-username /media/dir-name

Where “dir-name” is the name of the directory on your local computer where you want to access the files from the remote computer. Say I want the files on the server to be available at /media/home-pc. I want this because the “server” in this case is the desktop I have at home, which allows me to access it through ssh. Let us use “home-pc” as an example for this guide. “your-username” is your username on the local computer.

Go to System→Administration→Users and Groups, select the group “fuse” and then add yourself to this group.

If you prefer to do it the easy way, on the commandline, then use

$sudo adduser your-username fuse

For security reasons, the /usr/bin/fusermount binary is installed in such a way that users cannot execute it. You will have to log out and log in again, to add yourself to the group “fuse”.

Once you have done the above, you can use sshfs to mount the directory you need on the remote host to your local system!

For example, say I want to mount the “/stuff” directory on my home-run server, which has the domain name “example.com”. I would do it by executing the following command:

$sshfs example.com:/stuff /media/home-pc

Where “/stuff” is the folder on the computer with the domain name “example.com”, which I want to mount and access on my local computer at the location /media/home-pc.

Remember that the /media/home-pc directory must exist and be owned by you, the user. I already mentioned how to do this in the initial part of this guide.

If you get the following error:

    fusermount: fuse device not found, try ‘modprobe fuse’ first

You will have to load the fuse module by doing:

$sudo modprobe fuse

You can add fuse to the modules that are loaded on startup by editing the file /etc/modules and adding a line with only the word “fuse” in it, at the end.

and then issue the sshfs command above again.

To unmount the directory once your work is done, use the command:

$fusermount -u

for example, in my case, I would use

$fusermount -u /media/home-pc

Quelle2)

So kann man auf einem Debian-System Verzeichnisse anderer Server, zu denen man SSH-Zugriff hat, in das lokale Dateisystem einhängen.

Erst muß das erforderliche Paket installiert werden:

apt-get install sshfs

Ok, wenn das Paket installiert ist, muß nun das Kernel-Modul aktiviert werden:

modprobe fuse

Jetzt erstellen wir einen Mount-Point, z.B.:

mkdir /mnt/sshfs_dir

Jetzt hängen wir das Verzeichnis noch ein:

sshfs user@192.168.2.20:/home/user /mnt/sshfs_dir

Der Beispiel-Befehl hängt das Verzeichnis /home/user des Servers/PCs 192.168.2.20 in das lokale Dateisystem /mnt/sshfs_dir ein. Als Benutzername für 192.168.2.20 wird user verwendet.

Die am häufigsten benötigten Optionen:

Mit der Option -p 222 kann man statt dem Standard-Port 22 einen anderen verwenden Mit der Option -o kann man für das gemountete Verzeichnis u.a. eine umask (z.B. umask=0777), eine User-ID (uid=501), eine Gruppen-ID (gid=1000) und vieles mehr setzen.

Ein komplettes Beispiel:

sshfs user@192.168.2.20:/home/user /mnt/sshfs_dir -p 2244 -o umask=0775,uid=1001,gid=1000

Für eine Liste aller Optionen, siehe sshfs –help

Wenn man auf die Eingabe des Passworts beim Einhängen verzichten will, empfiehlt es sich, so vorzugehen: ssh-zugriff-ohne-anmeldung.html

That's it.

 
Nach oben
sshfs.txt · Zuletzt geändert: 2024/02/29 13:36 von 127.0.0.1
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp   Dogecoin Donations Accepted Here    DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp  DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp