web-dev-qa-db-ja.com

autofsがsshfsを使用してリモートドライブをマウントできない-fuse

私は現在、リモートの場所からいくつかのファイルを取得する必要があるアプリケーションを開発しています。このアプリケーションには、sshを介してのみアクセスできます。そのリポジトリを自動マウントする必要があるため、それについてautofsを設定しようとしました(ネットワーク障害後にfstabがマウントし直さないため、fstabに配置できません)。

残念ながら、設定で問題が発生しました。私の検索にもかかわらず、私は私の問題についての手がかりを見つけることができませんでした...それで私はここにいます。

基本的に、私は以前のように自動的に実行しようとしています。

sshfs [email protected]: /mnt/mylocalrepo -o allow_other 

Pidが502のTomcatユーザーにこれが必要です。これを行うために、auto.masterを次に示します。

# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $ 
/misc   /etc/auto.misc
/net    -hosts
/mnt    /etc/auto.sshfs --timeout=30, --ghost,  --debug

と私のauto.sshfs:

mylocalrepo -fstype=Fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,ro,allow_other :sshfs\#[email protected]\:

また、/ etc/sysconfg/autofsで出力レベルを「debug」に設定しました。

次に、/etc/init.d/autofs restart.

残念ながら、何も起こりません....ログには次のように書かれています。

Dec 19 11:52:03 something automount[17018]: handle_packet: type = 3
Dec 19 11:52:03 something automount[17018]: handle_packet_missing_indirect: token 279, name mylocalrepo, request pid 18480
Dec 19 11:52:03 something automount[17018]: attempting to mount entry /mnt/mylocalrepo
Dec 19 11:52:03 something automount[17018]: lookup_mount: lookup(file): looking up mylocalrepo
Dec 19 11:52:03 something automount[17018]: lookup_mount: lookup(file): mylocalrepo -> -fstype=Fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other :sshfs\#[email protected]\:
Dec 19 11:52:03 something automount[17018]: parse_mount: parse(Sun): expanded entry: -fstype=Fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other :sshfs\#[email protected]\:
Dec 19 11:52:03 something automount[17018]: parse_mount: parse(Sun): gathered options: fstype=Fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other
Dec 19 11:52:03 something automount[17018]: parse_mount: parse(Sun): dequote(":sshfs\#[email protected]\:") -> :sshfs#[email protected]:
Dec 19 11:52:03 something automount[17018]: parse_mount: parse(Sun): core of entry: options=fstype=Fuse,uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other, loc=:sshfs#[email protected]:
Dec 19 11:52:03 something automount[17018]: Sun_mount: parse(Sun): mounting root /mnt, mountpoint mylocalrepo, what sshfs#[email protected]:, fstype Fuse, options uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other
Dec 19 11:52:03 something automount[17018]: do_mount: sshfs#[email protected]: /mnt/mylocalrepo type Fuse options uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other using module generic
Dec 19 11:52:03 something automount[17018]: mount_mount: mount(generic): calling mkdir_path /mnt/mylocalrepo
Dec 19 11:52:03 something automount[17018]: mount_mount: mount(generic): calling mount -t Fuse -s -o uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other sshfs#[email protected]: /mnt/mylocalrepo

リポジトリは/ mnt /にあります:

dr-xr-xr-x 2 root root 0 déc 19 11:51 mylocalrepo

しかし、rootユーザーまたはTomcatユーザーを介してアクセスしようとすると、数分間フリーズした後、ログに次のように表示されます。

Dec 19 12:16:34 something automount[17018]: mount(generic): failed to mount sshfs#[email protected]: (type Fuse) on /mnt/mylocalrepo
Dec 19 12:16:34 something automount[17018]: dev_ioctl_send_fail: token = 280
Dec 19 12:16:34 something automount[17018]: failed to mount /mnt/mylocalrepo
Dec 19 12:16:34 something automount[17018]: handle_packet: type = 3
Dec 19 12:16:34 something automount[17018]: handle_packet_missing_indirect: token 281, name mylocalrepo, request pid 18480
Dec 19 12:16:34 something automount[17018]: attempting to mount entry /mnt/mylocalrepo
Dec 19 12:16:34 something automount[17018]: lookup_mount: lookup(file): looking up mylocalrepo
Dec 19 12:16:34 something automount[17018]: dev_ioctl_send_fail: token = 281
Dec 19 12:16:34 something automount[17018]: failed to mount /mnt/mylocalrepo

ですから、私の問題やそれについてのより多くの手がかりを見つける方法について何かアイデアやヒントを持っている人がいれば、彼らは本当に大歓迎です!

前もって感謝します。

私の設定 :

autofs-5.0.1-0.rc2.143.el5_5.6カーネル2.6.18-194.32.1.el5CentOSリリース5.5(最終版)

PS:この投稿は私がスタックオーバーフローに投稿したもののほぼ正確なコピーです...しかしそれはそれを尋ねる場所ではなかったように見えました。だから、この場所がそうなることを願っています。それでも解決しない場合は、時間をかけて理由を説明してください。

2
Marvin

autofsは、rootユーザーとしてマウントを実行しようとします。セットアップが機能するかどうかをテストするには、root(su-)としてログインし、autofs開始ログからマウント行を試してください。

`mount -t Fuse -s -o uid=502,gid=502,IdentityFile=/root/.ssh/myRsaPrivateKey,rw,allow_other sshfs#[email protected]: /mnt/mylocalrepo`

Autofsはまさにそれを実行するため(rootユーザーとしてリストされた引数を使用してmountを呼び出す)、失敗し、より適切なデバッグ出力が得られるはずです。通常、IDファイルのアクセス許可の問題が原因であることがわかります。

1
nerimarkinde