autofs dengan sshfs tidak berfungsi lagi [ditutup]


8

Saya baru saja memutakhirkan dari Ubuntu 12.04 menjadi 12.10. Sebelum itu saya membuat cadangan konfigurasi autofs saya yang berfungsi dengan baik. Saya menambahkan baris dari yang lama /etc/auto.masterke yang baru:

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

/etc/auto.sshfsPenampilan saya seperti ini:

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

Saya mencoba ini secara manual Connetion reset by peerjadi saya menambahkan opsi IdentityFile=/home/myuser/.ssh/id_rsa. Sekarang ini terjadi ketika saya mencoba mengakses /mnt(baik dengan manual dan 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/

Entri yang relevan dari saya /var/log/syslogadalah ini:

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

Saya sudah memeriksa UID dan GID dan mereka cocok dengan pengguna saya. Kunci SSH untuk pengguna saya sudah ada. Saya juga mencoba membuat /mnt/mymountsecara manual tetapi anehnya ia mengembalikan "izin ditolak" bahkan selama root berjalan (duga seharusnya seperti ini).

Ada ide apa yang mungkin salah? Harus ada langkah konfigurasi saya lupa yang saya lakukan sebelumnya.


Dari pertanyaan Anda, saya kumpulkan juga tidak bekerja secara manual. Lebih baik pertama mencoba untuk men-debug masalah ini , misalnya dengan mengaktifkan keluaran debug (lihat sshfs(1)) - ada banyak hal yang terlibat di sini (sekering, ssh, autofs) ... apakah koneksi biasa ssh(atau sftp) berfungsi dengan baik?
sr_

Ssh polos berfungsi dengan baik. Saya harus mengakui bahwa saya tidak mencoba manual sshfs mount. Terkadang Anda tidak memikirkan hal-hal yang paling sepele. Saya mencoba yang benar-benar didapat Connection reset by peer. Setelah itu saya menambahkan kunci ssh saya secara manual ke opsi. Sekarang saya punya kesalahan lain. Akan memperbarui pertanyaan saya untuk itu.
André Stannek

@ André hanya untuk klarifikasi, Anda mengatakan bahwa ketika menggunakan kedua autofs dan pemasangan secara manual, Anda mendapatkan cannot access mymountkesalahan dengan ?????hal itu?
Patrick

Sejujurnya setelah setengah tahun saya tidak yakin apa yang saya coba saat itu ;-) Saya kira saya mencoba me-mount secara manual untuk melihat apakah masalahnya terletak pada opsi sekering atau autofs saya. Saya bisa mencoba merekonstruksi masalah nanti, tetapi hari ini saya kekurangan waktu.
André Stannek

2
Pertanyaan nominasi untuk penutupan per komentar pada jawaban di bawah ini tidak digunakan lagi.
Patrick

Jawaban:


1

Ada beberapa jebakan yang dapat menyebabkan masalah yang Anda hadapi. Pada saat jawaban ini, Anda sudah memecahkan salah satunya, tetapi saya akan membahas semuanya (masalah Anda saat ini disebabkan oleh # 3).

1 - File identitas

Ini yang kamu selesaikan. Saat menjalankan sshfsdari autofs mount, sshfsberjalan sebagai pengguna root, jadi ia menggunakan kunci ssh root secara default. Anda harus menentukan IdentityFile=/home/user/.ssh/id_rsauntuk menggunakan kunci yang berbeda.

2 - host yang dikenal

Juga karena Anda menjalankan sshfssebagai pengguna selain yang biasanya Anda lakukan, Anda harus memastikan host jarak jauh yang Anda pasang ada di known_hostsfile. Ada beberapa cara untuk menyelesaikan masalah ini.

  1. ssh ke host jarak jauh sekali sebagai root dan menerima kunci host jarak jauh.
  2. Tambahkan parameter StrictHostKeyChecking=no. Ini akan membuat ssh menerima kunci apa pun yang dilihatnya (sehingga memperkenalkan sedikit rasa tidak aman).
  3. Tambahkan parameter UserKnownHostsFile=/home/user/.ssh/known_hosts. Ini akan membuatnya menggunakan known_hostsfile pengguna normal Anda.

3 - FUSE allow_other

Secara default sistem file sekering (yang sshfs) tidak memungkinkan pengguna, selain yang memasang sistem file, untuk mengaksesnya. Karena autof berjalan sebagai root, secara default, hanya root yang dapat mengaksesnya. Orang lain tidak akan memiliki izin (bahkan root jika dipasang oleh pengguna non-root), bahkan jika izin file yang sebenarnya mengatakan mereka harus bisa. Untuk mengatasi ini, Anda harus menambahkan opsi mount allow_other. Ini akan memungkinkan pengguna selain dari orang yang memasangnya untuk mengakses mount. Meskipun akses masih akan mematuhi izin tingkat file file pada mount.


Tidak membantu saya. Seperti yang Anda lihat dengan benar, saya sudah memecahkan yang pertama. Jumlah yang sama untuk yang kedua karena allow_otherpilihan sudah ada di /etc/auto.sshfsseperti yang Anda lihat di pertanyaan saya. Saya juga sering menggunakan ssh sehingga entri host dikenal juga ada.
André Stannek

@ AndréStannek wow, komentar lama, tetapi yang mana yang known_hostsAnda periksa? Dari komentar Anda tentang menggunakan ssh sering, saya kira Anda memeriksa pengguna Anda known_hosts. Anda perlu memeriksa root, karena root yang memanggil ssh.
Patrick

Maaf, tetapi sekarang saya tidak lagi menggunakan autofs seperti itu. Instalasi Ubuntu yang saya gunakan bahkan tidak ada lagi ;-)
André Stannek

1

Sudahkah Anda mencoba menjalankan autofs dengan opsi debugging?

sudo automount --debug -f /etc/auto.master akan memberikan Anda hasil debug ke terminal runnning.

Apakah Anda menambahkan root DAN pengguna Anda ke grup sekering?

sudo gpasswd -a $USER fuse


Baris debug sangat membantu. Bagi saya ada opsi tidak dikenal yang ditentukan dalam /etc/auto.sshfsfile.
user228395
Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.