autofs com sshfs não está mais funcionando [fechado]

8

Acabei de atualizar do Ubuntu 12.04 para 12.10. Antes disso, fiz o backup da minha configuração autofs, que funcionou bem. Anexei a linha do antigo /etc/auto.masterpara o novo:

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

minha /etc/auto.sshfsaparência assim:

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

Tentando isso manualmente eu consegui, Connetion reset by peerentão eu adicionei a opção IdentityFile=/home/myuser/.ssh/id_rsa. Agora isso acontece quando tento acessar /mnt(com manual e 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/

As entradas relevantes da minha /var/log/syslogsão as seguintes:

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

Eu já verifiquei o UID e o GID e eles correspondem ao meu usuário. As chaves SSH para o meu usuário estão no lugar. Eu também tentei criar /mnt/mymountmanualmente, mas estranhamente retorna "permissões negadas", mesmo enquanto root, enquanto o autofs estiver em execução (acho que deve ser assim).

Alguma idéia do que pode estar errado? Por uma etapa de configuração, esqueci o que fiz antes.

André Stannek
fonte
Da sua pergunta, entendo que também não funciona manualmente. Melhor tentar primeiro depurar esse problema , por exemplo, ativando a saída de depuração (consulte sshfs(1)) - há muitas coisas envolvidas aqui (fusível, ssh, autofs) ... uma conexão simples ssh(ou sftp) funciona corretamente?
sr_
O ssh simples funciona bem. Eu tenho que admitir que não tentei montar sshfs manual. Às vezes você não pensa nas coisas mais triviais. Eu tentei um realmente consegui Connection reset by peer. Depois disso, adicionei minha chave ssh manualmente às opções. Agora eu tenho outro erro. Atualizará minha pergunta para isso.
André Stannek 19/10/12
@ André apenas para esclarecimento, você está dizendo que, ao usar os autofs e a montagem manualmente, você recebe esse cannot access mymounterro com a ?????coisa?
Patrick
Para ser honesto depois de meio ano, não tenho certeza do que tentei naquela época ;-) Acho que tentei montar manualmente para ver se o problema está na minha opção de fusível ou nos autofs. Eu poderia tentar reconstruir o problema mais tarde, mas hoje estou com pouco tempo.
André Stannek 31/03
2
Pergunta de indicação para encerramento por comentário na resposta abaixo, que não é mais usada.
Patrick

Respostas:

1

Existem algumas armadilhas que podem causar problemas. Até o momento desta resposta, você já havia resolvido uma delas, mas eu as acertarei em todas (seu problema atual está sendo causado pelo # 3).

1 - O arquivo de identidade

Este é o que você resolveu. Ao executar a sshfspartir de uma montagem autofs, sshfsé executado como usuário root, portanto, usa a chave ssh do root por padrão. Você precisa especificar IdentityFile=/home/user/.ssh/id_rsapara usar uma chave diferente.

2 - hosts conhecidos

Também porque você está executando sshfscomo um usuário diferente daquele que você normalmente faz, é necessário garantir que o host remoto que você está montando esteja no known_hostsarquivo. Existem algumas maneiras de resolver esse problema.

  1. ssh para o host remoto uma vez como root e aceite a chave do host remoto.
  2. Adicione o parâmetro StrictHostKeyChecking=no. Isso fará com que o ssh aceite qualquer chave que ele veja (portanto, introduz um pouco de insegurança).
  3. Adicione o parâmetro UserKnownHostsFile=/home/user/.ssh/known_hosts. Isso fará com que você use o known_hostsarquivo do seu usuário normal.

3 - FUSE allow_other

Por padrão, um sistema de arquivos com fusível (que é o sshfs) não permite que usuários, além daquele que montou o sistema de arquivos, o acessem. Como o autofs é executado como root, por padrão, somente o root pode acessá-lo. Qualquer outra pessoa não terá permissões (mesmo root, se montada por um usuário não root), mesmo que as permissões de arquivo reais digam que deveriam. Para resolver isso, você deve adicionar a opção de montagem allow_other. Isso permitirá que outros usuários, além daquele que o montou, acessem o suporte. Embora o acesso ainda obedeça às permissões no nível dos arquivos na montagem.

Patrick
fonte
Isso não me ajuda. Como você viu corretamente, eu já resolvi o primeiro. O mesmo vale para o segundo, pois a allow_otheropção já está no, /etc/auto.sshfscomo você pode ver na minha pergunta. Eu também uso ssh frequentemente, então a entrada de hosts conhecidos também está lá.
André Stannek 30/03
@ AndréStannek uau, comentário antigo, mas qual known_hostsvocê conferiu ? Do seu comentário sobre o uso do ssh com frequência, acho que você verificou o usuário known_hosts. Você precisa verificar o root, pois ele está chamando o ssh.
Patrick
Desculpe, mas agora eu não uso mais autofs assim. As instalações do Ubuntu que eu usei não existe mais ;-)
André Stannek
1

Você já tentou executar autofs com opções de depuração?

sudo automount --debug -f /etc/auto.master fornecerá a saída de depuração para o terminal runnning.

Você adicionou root E seu usuário ao grupo de fusíveis?

sudo gpasswd -a $USER fuse

os_1
fonte
A linha de depuração é muito útil. Para mim, havia uma opção desconhecida especificada no /etc/auto.sshfsarquivo.
user228395 13/03