LoginSignup
1
2

More than 1 year has passed since last update.

wsl2でsshfsを使ってサーバーをmountしたら、explorerから見れた。

Posted at

前提

windows10にwsl2がインストールされていて、ubuntu20.04LTS(普通のLinuxなら大丈夫だと思う)が入っている。
普段sshを使ってサーバーにアクセスしている。
windows10のexplorerからサーバー上のファイルとかを見たい!!

方法

sshfsをubuntu(wsl2)にインストール

sudo apt update
sudo apt upgrade
sudo apt install sshfs

sshfsはmountするためのやつです。

ubuntu上にmount pointを作成。

sudo mkdir /mnt/my-remote-server

mount pointを私のものにする。

sudo chown $USER: /mnt/my-remote-server/

mountする

-o allow_other オプションをつけずにmountするとmount自体は可能だが、explorerからmount pointを開こうとしたときにエラーが出てくる。まず、-o allow_other オプションがroot以外の人でも使えるように/etc/fuse.confを編集する。

sudo vi /etc/fuse.conf

user_allow_other をコメントイン

/etc/fuse.conf
# /etc/fuse.conf - Configuration file for Filesystem in Userspace (FUSE)

# Set the maximum number of FUSE mounts allowed to non-root users.
# The default is 1000.
#mount_max = 1000

Allow non-root users to specify the allow_other or allow_root mount options.
user_allow_other # ここをコメントイン

mountする。

sshfs hogename@hogeremtoeserver:/ /mnt/my-remote-server -o allow_other

これでどのuserからでも見れるようにmountできました。

explorerでmount pointを見る

cd /mnt/my-remote-server
explorer.exe .

無事見れましたね😊

参考

ngyukiの日記[https://ngyuki.hatenablog.com/entry/2020/08/30/143734]

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2