Warum schlägt das automatische Mounten von sshfs mit autofs fehl?

5898
Cyril N.

Ich versuche verzweifelt, meinen entfernten Ordner automatisch mit autofs & sshfs zu mounten, aber ich kann es nicht zum Laufen bringen. (Ich bin unter Fedora 16)

Das funktioniert :

sshfs cx42net@xxx.xxx.xxx.xxx:/my/data /home/cx42net/data-distant -o uid=1000 -o gid=1000 

Also habe ich einen RSA-Schlüssel für die Verwendung mit ssh definiert, eine sshVerbindung hergestellt und es funktionierte, ohne mein Passwort zu fragen. Dann habe ich den vorherigen sshfsBefehl erneut versucht, und es hat gut funktioniert (yay!)

Ich möchte es jetzt verwenden autofs, und hier beginnt das Problem:

Inhalt meiner /etc/auto.master-Datei:

# # Sample auto.master file # This is an automounter map and it has the following format # key [ -mount-options-separated-by-comma ] location # For details of the format look at autofs(5). # /misc /etc/auto.misc # # NOTE: mounts done from a hosts map will be mounted with the # "nosuid" and "nodev" options unless the "suid" and "dev" # options are explicitly given. # /net -hosts # # Include /etc/auto.master.d/*.autofs # +dir:/etc/auto.master.d # # Include central master map if it can be found using # nsswitch sources. # # Note that if there are entries for /net or /misc (as  # above) in the included master map any keys that are the # same will not be seen as the first read key seen takes # precedence. # +auto.master  /net /etc/auto.sshfs uid=1000,gid=1000,--timeout=30,--ghost 

(1000: 1000) ist mein lokaler Benutzer uid / gid, nicht der entfernte (der SSH-Ordner, den ich abrufen möchte)

Mein /etc/auto.sshfs:

data-distant -fstype=fuse,port=22,rw,allow_other :sshfs\#cx42net@xxx.xxx.xxx.xxx\:/mnt/data/dev 

Wenn ich autofs starte, habe ich Folgendes in der /var/log/messages:

Oct 28 23:59:30 pc-maison autofs[3318]: Starting automount: [ OK ] 

Also scheint alles gut zu sein.

Aber manchmal bekam ich diese Art von Nachrichten:

Oct 28 23:41:01 pc-maison automount[2453]: create_udp_client: hostname lookup failed: Name or service not known Oct 28 23:41:01 pc-maison automount[2453]: create_tcp_client: hostname lookup failed: Name or service not known Oct 28 23:41:01 pc-maison automount[2453]: lookup_mount: exports lookup failed for data-distant 

Die Ordner /net/data-distanthaben Rechte meines Benutzers "cx42net" (1000: 1000)

Was fehlt mir, um dies zu erreichen?

3

1 Antwort auf die Frage

2
Manwe

Kurz:

Überprüfen Sie, ob Ihr Befehl sshfs mit dem Benutzer root funktioniert.

Länger:

Stellen Sie sicher, dass der root-Benutzer die ssh-Identifizierungsschlüssel eingerichtet hat. Das Einhängen von sshfs durch autofs verwendet den root-Benutzer für das eigentliche Einhängen.

Dies ist immer noch nur für Desktop- oder Laptop-Benutzer mit einem einzelnen Benutzer gedacht, der diese Halterungen verwendet!

auto.master line

Hinweis! Verwenden Sie Ihre eigene UID und GID und geben Sie Ihren bevorzugten Einhängepunkt an, den ich / auto / mehtod / addresse

/auto/sshfs /etc/auto.sshfs uid=1000,gid=1000,--timeout=60,--ghost 

auto.sshfs Dies ist etwas generischer als nur ein Mount

#!/bin/bash  # Shell script that acccepts one argument, namely userid@server # env >> /tmp/env_check # whoami >> /tmp/env_check  key=$1 USER='your_local_user_used_for_ssh_identity_file' REMOTEDEFAULT='default_to_this_user_otherwise_root' key=$  # add user [[ ! "$key" =~ "@" ]] && key="$@$"  case $key in $@.Trash*) exit 1;; *) ( echo "-fstype=fuse,idmap=user,rw,nodev,nonempty,transform_symlinks,noatime,allow_other,IdentityFile=/home/$/.ssh/id_dsa,max_read=65536\\" echo -e "\t /uhome :sshfs\#$key\:\\" echo -e "\t /tmp :sshfs\#$key\:\/tmp\/\\" echo -e "\t /rootfs :sshfs\#$key\:\/") esac  ## this is a bit more complex. It creates subfolders to autofs-mount/remotename ## /uhome = your remote homedirectory ## /rootfs = remote root '/' ## /tmp = remote tmp # same as /roots/tmp 

Verbinden Sie sich dann mit dem Ordner, auf den Sie zugreifen möchten: ln -s /auto/sshfs/userid@my.remote.example.com/uhome/ remote-home