LoginSignup
3
1

More than 3 years have passed since last update.

LinuxからのWindows共有フォルダの利用

Posted at

使いどころ

ネットワーク上でLinuxマシンからWindows上の共有フォルダを見たいときというとシチュエーションが一般的だが、WindowsServer上のHyper-VにLinuxを建てて作業している際に、Windowsのフォルダにログなどの証跡物を持っていきたい時などにはこの方法が一番楽だと思う。
どちらかというと自分の備忘録的に記しておく。

前提条件など

前提として、コマンドの実行ユーザーはsudo権限を持っていることが必要になる。
コマンドの表記は、Windowsのサーバー名またはIPアドレス(ホスト名解決ができていない可能性が高いので、この場合はIPか?)を、共有フォルダの名称を、マウントするフォルダを/mnt/win/sharedとする。
また、WindowsにログインするユーザーIDは、パスワードはと記載する。

共有フォルダをマウントする場合

以下のコマンドを実行

sudo mount -t cifs //<servername>/<foldername> /mnt/win/shared/ -o username=<user>,password=<pass>,dir_mode=0777,file_mode=0777

ここでcifsはwindowsのファイルシステムのこと。また、dir_mode, file_modeで書/読の権限を設定している。

共有フォルダをアンマウントする場合

共有フォルダを使わなくなった場合は、不用意にファイルの操作を行わないよう、忘れずにアンマウントしてあげる。

umount  /mnt/win/shared/
3
1
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
3
1