autofs con sshfs ya no funciona [cerrado]

8

Acabo de actualizar Ubuntu 12.04 a 12.10. Antes de eso, hice una copia de seguridad de mi configuración de autofs que funcionó bien. Agregué la línea de mi antiguo /etc/auto.masteral nuevo:

+dir:/etc/auto.master.d
+auto.master
/mnt /etc/auto.sshfs uid=1000,gid=1000,--timeout=30,--ghost,--verbose

mi se /etc/auto.sshfsve así:

mymount -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#myuser@mydomain:/mnt/mymount

Intenté esto manualmente, Connetion reset by peerasí que agregué la opción IdentityFile=/home/myuser/.ssh/id_rsa. Ahora esto sucede cuando intento acceder /mnt(tanto con manual como con autofs):

myuser@laptop /mnt % la
ls: cannot access mymount: No such file or directory
total 4
drwxr-xr-x  3 root root    0 Oct 19 10:34 ./
drwxr-xr-x 25 root root 4096 Oct 18 23:17 ../
d?????????  ? ?    ?       ?            ? mymount/

Las entradas relevantes de my /var/log/syslogson esto:

Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: lookup(program): lookup for mymount failed
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: attempting to mount entry /mnt/mymount
Oct 19 00:17:56 laptop automount[1250]: failed to mount /mnt/mymount
Oct 19 00:18:01 laptop automount[1250]: attempting to mount entry /mnt/.hidden
Oct 19 00:18:01 laptop automount[1250]: lookup(program): lookup for .hidden failed
Oct 19 00:18:01 laptop automount[1250]: failed to mount /mnt/.hidden
Oct 19 00:18:03 laptop automount[1250]: attempting to mount entry /mnt/.hidden
Oct 19 00:18:03 laptop automount[1250]: failed to mount /mnt/.hidden
Oct 19 00:18:03 laptop automount[1250]: attempting to mount entry /mnt/.hidden
Oct 19 00:18:03 laptop automount[1250]: failed to mount /mnt/.hidden
Oct 19 00:18:24 laptop automount[1250]: attempting to mount entry /mnt/.hidden
Oct 19 00:18:24 laptop automount[1250]: failed to mount /mnt/.hidden
Oct 19 00:21:57 laptop automount[1250]: umount_autofs_indirect: ask umount returned busy /mnt
Oct 19 00:21:59 laptop automount[1250]: shut down path /mnt
Oct 19 00:21:59 laptop automount[3436]: mounted indirect on /mnt with timeout 30, freq 8 seconds
Oct 19 00:21:59 laptop automount[3436]: ghosting enabled

Ya verifiqué el UID y el GID y coinciden con mi usuario. Las claves SSH para mi usuario están en su lugar. También traté de crear /mnt/mymountmanualmente, pero extrañamente devuelve "permisos denegados" incluso cuando el root está en ejecución mientras autofs se está ejecutando (supongo que debería ser así).

¿Alguna idea de lo que podría estar mal? Por un paso de configuración, olvidé lo que hice antes.

André Stannek
fuente
De su pregunta, deduzco que tampoco funciona manualmente. Mejor primero intente depurar este problema , por ejemplo, habilitando la salida de depuración (vea sshfs(1)): hay muchas cosas involucradas aquí (fusible, ssh, autofs) ... ¿ funciona correctamente una conexión simple ssh(o sftp)?
sr_
SSH simple funciona bien. Tengo que admitir que no probé el montaje manual de sshfs. A veces no piensas en las cosas más triviales. Intenté un realmente tengo Connection reset by peer. Después de eso agregué mi clave ssh manualmente a las opciones. Ahora tengo otro error. Actualizaré mi pregunta para eso.
André Stannek
@ André solo para aclarar, ¿estás diciendo que cuando usas ambos autofs y montas manualmente, obtienes ese cannot access mymounterror con la ?????cosa?
Patrick
Para ser honesto después de medio año, no estoy seguro de lo que intenté en ese momento ;-) Supongo que intenté montarlo manualmente para ver si el problema radica en mi opción de fusible o autofs. Podría intentar reconstruir el problema más adelante, pero hoy tengo poco tiempo.
André Stannek
2
Pregunta de nominación para el cierre por comentario en la respuesta a continuación que ya no se usa.
Patrick

Respuestas:

1

Hay algunas trampas que pueden causar los problemas con los que te encuentras. Hasta el momento de esta respuesta, ya has resuelto una de ellas, pero las resolveré todas (tu problema actual está siendo causado por el n. ° 3).

1 - El archivo de identidad

Este es el que resolviste. Cuando se ejecuta sshfsdesde un montaje de autofs, se sshfsejecuta como usuario root, por lo que utiliza la clave ssh de root de forma predeterminada. Debe especificar IdentityFile=/home/user/.ssh/id_rsapara usar una clave diferente.

2 - hosts conocidos

Además, debido a que está ejecutando sshfscomo un usuario diferente al que normalmente hace, debe asegurarse de que el host remoto que está montando esté en el known_hostsarchivo. Hay algunas formas de resolver este problema.

  1. ssh al host remoto una vez como root y acepte la clave del host remoto.
  2. Agrega el parámetro StrictHostKeyChecking=no. Esto hará que ssh acepte cualquier clave que vea (por lo que introduce un poco de inseguridad).
  3. Agrega el parámetro UserKnownHostsFile=/home/user/.ssh/known_hosts. Esto hará que use el known_hostsarchivo de su usuario normal.

3 - FUSE allow_other

Por defecto, un sistema de archivos con fusible (que es sshfs) no permite que los usuarios, que no sean los que montaron el sistema de archivos, puedan acceder a él. Dado que autofs se ejecuta como root, de forma predeterminada, solo root puede acceder a él. Cualquier otra persona no tendrá permisos (incluso root si es montado por un usuario no root), incluso si los permisos de archivo reales dicen que deberían poder hacerlo. Para resolver esto, debe agregar la opción de montaje allow_other. Esto permitirá a los usuarios que no sean quienes lo montaron acceder al montaje. Aunque el acceso seguirá obedeciendo los permisos a nivel de archivo de los archivos en el soporte.

Patricio
fuente
No me ayuda Como viste correctamente, ya resolví el primero. Lo mismo cuenta para el segundo ya que la allow_otheropción ya está en el /etc/auto.sshfscomo se puede ver en mi pregunta. También uso ssh con frecuencia, por lo que la entrada de hosts conocidos también está allí.
André Stannek
@ AndréStannek wow, viejo comentario, pero ¿cuál known_hostscomprobaste? Por su comentario sobre el uso frecuente de ssh, supongo que comprobó a su usuario known_hosts. Debe verificar la raíz, ya que es la raíz la que invoca ssh.
Patrick
Lo siento, pero ahora ya no uso autofs como ese. Las instalaciones de Ubuntu que utilicé ya no existen ;-)
André Stannek
1

¿Has intentado ejecutar autofs con opciones de depuración?

sudo automount --debug -f /etc/auto.master le dará la salida de depuración a la terminal en ejecución.

¿Agregaste root Y tu usuario al grupo de fusibles?

sudo gpasswd -a $USER fuse

os_1
fuente
La línea de depuración es muy útil. Para mí había una opción desconocida especificada en el /etc/auto.sshfsarchivo.
user228395