autofs con sshfs non funziona più [chiuso]


8

Ho appena aggiornato da Ubuntu 12.04 a 12.10. Prima di allora ho eseguito il backup della mia configurazione di autofs che ha funzionato bene. Ho aggiunto la linea dal mio vecchio /etc/auto.mastera quello nuovo:

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

il mio /etc/auto.sshfsassomiglia a questo:

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

Provando questo manualmente ho ottenuto Connetion reset by peercosì ho aggiunto l'opzione IdentityFile=/home/myuser/.ssh/id_rsa. Ora questo succede quando provo ad accedere /mnt(sia con il manuale che con l'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/

Le voci rilevanti dal mio /var/log/syslogsono queste:

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

Ho già controllato l'UID e GID e corrispondono al mio utente. Le chiavi SSH per il mio utente sono a posto. Ho anche provato a creare /mnt/mymountmanualmente ma stranamente restituisce "permessi negati" anche se root fintanto che autofs è in esecuzione (suppongo che dovrebbe essere così).

Qualche idea di cosa potrebbe essere sbagliato? In una fase di configurazione, ho dimenticato che avevo fatto prima.


Dalla tua domanda, ho capito che non funziona neanche manualmente. Meglio prima provare a eseguire il debug di questo problema , ad esempio abilitando l'output di debug (vedi sshfs(1)) - ci sono molte cose coinvolte qui (miccia, ssh, autofs) ... una connessione semplice ssh(o sftp) funziona correttamente?
sr_

Plain ssh funziona bene. Devo ammettere che non ho provato il mount manuale di sshfs. A volte non pensi alle cose più banali. Ho provato davvero Connection reset by peer. Successivamente ho aggiunto manualmente la mia chiave ssh alle opzioni. Ora ho un altro errore. Aggiornerò la mia domanda per questo.
André Stannek,

@ André solo per chiarimenti, stai dicendo che quando si utilizzano sia autofs che il montaggio manualmente, si ottiene quell'errore cannot access mymountcon la ?????cosa?
Patrick

Ad essere sinceri dopo sei mesi non sono sicuro di cosa ho provato allora ;-) Immagino di aver provato a montare manualmente per vedere se il problema risiede nella mia opzione di fusibile o autofs. Potrei provare a ricostruire il problema più tardi, ma oggi ho poco tempo.
André Stannek,

2
Domanda di nomina per chiusura per commento sulla risposta di seguito che non viene più utilizzata.
Patrick,

Risposte:


1

Ci sono alcune insidie ​​che possono causare i problemi che si verificano. Al momento della risposta, ne hai già risolto uno, ma li colpirò tutti (il tuo problema attuale è causato dal n. 3).

1 - Il file di identità

Questo è quello che hai risolto. Quando viene eseguito sshfsda un mount autofs, sshfsviene eseguito come utente root, quindi per impostazione predefinita utilizza la chiave ssh di root. Devi specificare IdentityFile=/home/user/.ssh/id_rsadi usare una chiave diversa.

2 - host noti

Inoltre, poiché si esegue sshfsun utente diverso da quello che si fa normalmente, è necessario assicurarsi che l'host remoto che si sta montando sia nel known_hostsfile. Esistono alcuni modi per risolvere questo problema.

  1. ssh all'host remoto una volta come root e accetta la chiave dell'host remoto.
  2. Aggiungere il parametro StrictHostKeyChecking=no. Questo farà sì che ssh accetti qualsiasi chiave che vede (quindi introduce un po 'di insicurezza).
  3. Aggiungere il parametro UserKnownHostsFile=/home/user/.ssh/known_hosts. Questo lo farà usare il known_hostsfile del tuo normale utente.

3 - FUSE allow_other

Di default un filesystem con fusibili (che è sshfs) non consente agli utenti, oltre a quello che ha montato il filesystem, di accedervi. Poiché autofs viene eseguito come root, per impostazione predefinita, solo root può accedervi. Chiunque altro non disporrà delle autorizzazioni (anche root se montato da un utente non root), anche se le autorizzazioni dei file effettive dicono che dovrebbero essere in grado di farlo. Per risolvere questo problema devi aggiungere l'opzione mount allow_other. Ciò consentirà agli utenti diversi da quello che lo ha montato di accedere al mount. Sebbene l'accesso obbedirà comunque alle autorizzazioni a livello di file dei file sul mount.


Non mi aiuta Come hai visto correttamente ho già risolto il primo. Lo stesso allow_othervale per il secondo in quanto l' opzione è già presente /etc/auto.sshfscome puoi vedere nella mia domanda. Uso anche ssh frequentemente così anche la voce host conosciuta è lì.
André Stannek,

@ AndréStannek wow, vecchio commento, ma quale known_hostshai controllato? Dal tuo commento sull'uso frequente di ssh, immagino tu abbia controllato il tuo utente known_hosts. Devi controllare root, poiché è root che sta invocando ssh.
Patrick,

Scusa, ma ormai non uso più autofs del genere. Le installazioni di Ubuntu che ho usato non esistono nemmeno più ;-)
André Stannek il

1

Hai provato a eseguire autofs con opzioni di debug?

sudo automount --debug -f /etc/auto.master ti darà l'output di debug al terminale di runnning.

Hai aggiunto root AND il tuo utente al gruppo di fusibili?

sudo gpasswd -a $USER fuse


La linea di debug è molto utile. Per me c'era un'opzione sconosciuta specificata nel /etc/auto.sshfsfile.
user228395
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.