私は指示に従った。sshfs "要求時に"インストールしかし、うまくいきません。
私はこれを次に追加します/etc/fstab
:
username@hostname:/ /mnt/remotes/hostname fuse.sshfs noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/stanley/.ssh/my_rsa_key,allow_other,reconnect 0 0
それから逃げてsudo mount -a
何もしませんでした。私もそれを試しましたsystemctl daemon-reload && systemctl restart proc-sys-fs-binfmt_misc.automount
。
だから私は従うトラブルシューティングのヒント、次に置き換えます。
username@hostname:/ /mnt/remotes/hostname fuse.sshfs ssh_command=ssh\040-vv,sshfs_debug,debug,_netdev,users,idmap=user,IdentityFile=/home/stanley/.ssh/my_rsa_key,allow_other,reconnect 0 0
そして彼は逃げたsudo mount -av
。別の端末からマウントポイントにアクセスできます。
したがって、1) ssh と sftp が稼働中、2) sshfs が稼働中、3) 権限が正常です。
これにより、オンデマンド部分のみが機能しません。私が何を間違っているのでしょうか?
ベストアンサー1
これらのガイドラインは、特にsystemdを知らない人にとっては混乱しています。
正しい手順:
次に追加
/etc/fstab
:username@hostname:/ /mnt/remotes/hostname fuse.sshfs noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/stanley/.ssh/my_rsa_key,allow_other,reconnect 0 0
ランニング
sudo systemctl daemon-reload
。これにより、システム化された「単位ファイル」が作成されます。を実行して、どのユニットファイルが何であるかを調べます
systemctl list-unit-files --type automount
。私としてはそうですmnt-remotes-hostname.automount
。活動化:
sudo systemctl restart mnt-remotes-hostname.automount
。cd /mnt/remotes/hostname
または、ls /mnt/remotes/hostname
自動的にSFTP接続が作成されます!
これはうまくいきますが、まだわかりません。
- 誰かが
allow_other
セキュリティ上のリスクがあると言っていますが、調査する必要があります。 - マウントを自動的にマウント解除する時期(アイドル時間数秒など)を指定する方法がわかりません。
誰もがこれについて明らかにできる場合は、そうします。
修正する
@sourcejedisの回答によると、インストールの停止は次の順序で実行する必要があり、systemctl stop whatever.mount && systemctl stop whatever.automount
使用しないでくださいumount mounpoint
。