LoginSignup
4
7

More than 3 years have passed since last update.

ラズパイでWindows共有フォルダーを使用できるようにする

Last updated at Posted at 2019-09-13

ラズベリーパイを使ってWindows共有フォルダーにアクセスする方法。

Sambaのインストール

sambaは文字通りSamba本体のインストールです。winbindlibnss-winbindはWindowsのコンピューター名で名前解決するためのものです。

$ sudo apt-get update
$ sudo apt-get install samba
$ sudo apt-get install smbclient
$ sudo apt-get install winbind
$ sudo apt-get install libnss-winbind

/etc/nsswitch.confにwinsを書き加える

/etc/nsswitch.confファイルのhosts:と記載されている行にwinsを書き加えます。

/etc/nsswitch.conf
hosts:          files mdns4_minimal [NOTFOUND=return] dns wins

共有フォルダーを探してみる

smbtreeコマンドで共有フォルダーの一覧が表示できます。

$ smbtree
Unable to initialize messaging context
WORKGROUP
    \\RASPBERRYPI           Samba 4.9.5-Debian
        \\RASPBERRYPI\EPSON-EP-902A     EPSON EP-902A
        \\RASPBERRYPI\IPC$              IPC Service (Samba 4.9.5-Debian)
        \\RASPBERRYPI\USERFILES         User Files
        \\RASPBERRYPI\print$            Printer Drivers
    \\DMR-BRX_BX2050        DIGA file sharing
        \\DMR-BRX_BX2050\IPC$               IPC Service (DIGA file sharing)
        \\DMR-BRX_BX2050\USER_area          User area of DIGA HDD

smbclient -L (コンピューター名)は、共有フォルダーを提供しているコンピューター名を指定して、共有フォルダーの一覧を確認します。

$ smbclient -L (コンピューター名)

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

mount -t cifsで共有フォルダーをマウントします。
尚、user= と password= には共有フォルダーにアクセス権のあるユーザー名とパスワードを適宜指定してください。

$ sudo mount -t cifs -o user=abc,password=xxx //(コンピューター名)/(共有フォルダー名) /(マウント先)
4
7
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
4
7