物理の駅 Physics station by 現役研究者

テクノロジーは共有されてこそ栄える

Ubuntuでsshfs

Ubuntuでスクショを撮ったとき、サーバーに自動転送するために、SSHFSでScreenshotsディレクトリにサーバー側のディレクトリをマウントすることを考えた。

SSHFSを使ってマウントする

sshfs user@server.host:/Users/user/ScreenShots /home/user/Pictures/Screenshots

マウント状態を確認するには

$ mount | grep sshfs
user@server.host:/Users/user/ScreenShots on /home/user/Pictures/Screenshots type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

マウントを外すときは

fusermount -u /home/user/Pictures/Screenshots

はずせず、

fusermount: failed to unmount /home/user/Pictures/Screenshots: Device or resource busy

とでるときは、

lsof +D /home/user/Pictures/Screenshots

としてPID (process id)で kill 3002 などとする。