質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

Raspbian

Raspbianは、DebianベースのRaspberry Pi用ディストリビューション。ハードウェア浮動小数点演算を有効にすることが可能で、Webブラウズなどの速度を向上できます。

Raspberry Pi

Raspberry Piは、ラズベリーパイ財団が開発した、名刺サイズのLinuxコンピュータです。 学校で基本的なコンピュータ科学の教育を促進することを意図しています。

samba

Samba(サンバ)とは、UNIX系OSにおいてSMBを用いたサービスを提供するためのソフトウェアです。ネットワークを通じて、ファイル共有及びプリンタ共有などのサービスをWindowsマシンへと提供します。ライセンス体系GPLに基づきフリーソフトウェアとして公開されています。

Q&A

解決済

1回答

11836閲覧

ラズパイのSambaでファイル共有するとエラーが出る

dufasbl-150

総合スコア19

Windows 10

Windows 10は、マイクロソフト社がリリースしたOSです。Modern UIを標準画面にした8.1から、10では再びデスクトップ主体に戻され、UIも変更されています。PCやスマホ、タブレットなど様々なデバイスに幅広く対応していることが特徴です。

Raspbian

Raspbianは、DebianベースのRaspberry Pi用ディストリビューション。ハードウェア浮動小数点演算を有効にすることが可能で、Webブラウズなどの速度を向上できます。

Raspberry Pi

Raspberry Piは、ラズベリーパイ財団が開発した、名刺サイズのLinuxコンピュータです。 学校で基本的なコンピュータ科学の教育を促進することを意図しています。

samba

Samba(サンバ)とは、UNIX系OSにおいてSMBを用いたサービスを提供するためのソフトウェアです。ネットワークを通じて、ファイル共有及びプリンタ共有などのサービスをWindowsマシンへと提供します。ライセンス体系GPLに基づきフリーソフトウェアとして公開されています。

0グッド

0クリップ

投稿2019/05/18 09:57

#質問したいこと
こんにちは。
Sambaを使い、raspberrypiに接続した外付けHDDをwifiで共有しようとしています。
そこにパスワードを設定しようとしています。

しかし、windows10のエクスプローラーからアクセスしようとすると、以下のエラーメッセージが出ます。

\192.168.11.OO\piに対するアクセス許可がありません。ネットワーク管理者にアクセス許可を要求してください。

#試したこと
以下のコードを書きました。

smb.conf

[pi] browseable = yes writeable = yes path = /media/pi/ハードディスク名/フォルダ名/ force create mode = 0777 force directory mode = 0777 force group = sambashare guest ok = yes guest only = yes

上記のコードはこのサイトを参考にしました

・Sambaの利用者登録はしてあります。
・Sambaに登録するために、ラズパイのユーザーも作ってあります

#現在の状態をまとめると・・・

・windowsエクスプローラーからアクセスしようとすると、資格情報の入力も表示されずに、  **\192.168.11.OO\piに対するアクセス許可がありません。ネットワーク管理者にアクセス許可を要求してください。**と表示される。 

・Sambaの共有設定はしっかりできているはず。

ご回答よろしくお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

mt08

2019/05/19 04:56

外付けHDDのファイルシステムは、ext4 ですか?
TaichiYanagiya

2019/05/20 14:41

smb.conf の [global] セクションの設定内容も記載ください。 また、切り分けのため、以下を試してくださいませんでしょうか。 (1) path を外付けHDDではなく、ローカルのディレクトリにした場合、どうなるか (2) Windows ではなく、raspberrypi の端末から smbclient コマンドで接続した場合、どうなるか
dufasbl-150

2019/05/21 09:35

smb.conf の [global] セクションは以下の通りです。 #======================= Global Settings ======================= [global] unix charset = UTF-8 dos charset = CP932 security = user ntlm auth = yes ## Browsing/Identification ### # Change this to the workgroup/NT-domain name your Samba server will part of workgroup = WORKGROUP # Windows Internet Name Serving Support Section: # WINS Support - Tells the NMBD component of Samba to enable its WINS Server # wins support = no # WINS Server - Tells the NMBD components of Samba to be a WINS Client # Note: Samba can be either a WINS Server, or a WINS Client, but NOT both ; wins server = w.x.y.z # This will prevent nmbd to search for NetBIOS names through DNS. dns proxy = no #### Networking #### # The specific set of interfaces / networks to bind to # This can be either the interface name or an IP address/netmask; # interface names are normally preferred ; interfaces = 127.0.0.0/8 eth0 # Only bind to the named interfaces and/or networks; you must use the # 'interfaces' option above to use this. # It is recommended that you enable this feature if your Samba machine is # not protected by a firewall or is a firewall itself. However, this # option cannot handle dynamic or non-broadcast interfaces correctly. ; bind interfaces only = yes #### Debugging/Accounting #### # This tells Samba to use a separate log file for each machine # that connects log file = /var/log/samba/log.%m # Cap the size of the individual log files (in KiB). max log size = 1000 # If you want Samba to only log through syslog then set the following # parameter to 'yes'. # syslog only = no # We want Samba to log a minimum amount of information to syslog. Everything # should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log # through syslog you should set the following parameter to something higher. syslog = 0 # Do something sensible when Samba crashes: mail the admin a backtrace panic action = /usr/share/samba/panic-action %d ####### Authentication ####### # Server role. Defines in which mode Samba will operate. Possible # values are "standalone server", "member server", "classic primary # domain controller", "classic backup domain controller", "active # directory domain controller". # # Most people will want "standalone sever" or "member server". # Running as "active directory domain controller" will require first # running "samba-tool domain provision" to wipe databases and create a # new domain. server role = standalone server # If you are using encrypted passwords, Samba will need to know what # password database type you are using. passdb backend = tdbsam obey pam restrictions = yes # This boolean parameter controls whether Samba attempts to sync the Unix # password with the SMB password when the encrypted SMB password in the # passdb is changed. unix password sync = yes # For Unix password sync to work on a Debian GNU/Linux system, the following # parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for # sending the correct chat script for the passwd program in Debian Sarge). passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . # This boolean controls whether PAM will be used for password changes # when requested by an SMB client instead of the program listed in # 'passwd program'. The default is 'no'. pam password change = yes # This option controls how unsuccessful authentication attempts are mapped # to anonymous connections map to guest = bad user ########## Domains ########### # # The following settings only takes effect if 'server role = primary # classic domain controller', 'server role = backup domain controller' # or 'domain logons' is set # # It specifies the location of the user's # profile directory from the client point of view) The following # required a [profiles] share to be setup on the samba server (see # below) ; logon path = \\%N\profiles\%U # Another common choice is storing the profile in the user's home directory # (this is Samba's default) # logon path = \\%N\%U\profile # The following setting only takes effect if 'domain logons' is set # It specifies the location of a user's home directory (from the client # point of view) ; logon drive = H: # logon home = \\%N\%U # The following setting only takes effect if 'domain logons' is set # It specifies the script to run during logon. The script must be stored # in the [netlogon] share # NOTE: Must be store in 'DOS' file format convention ; logon script = logon.cmd # This allows Unix users to be created on the domain controller via the SAMR # RPC pipe. The example command creates a user account with a disabled Unix # password; please adapt to your needs ; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u # This allows machine accounts to be created on the domain controller via the # SAMR RPC pipe. # The following assumes a "machines" group exists on the system ; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u # This allows Unix groups to be created on the domain controller via the SAMR # RPC pipe. ; add group script = /usr/sbin/addgroup --force-badname %g ############ Misc ############ # Using the following line enables you to customise your configuration # on a per machine basis. The %m gets replaced with the netbios name # of the machine that is connecting ; include = /home/samba/etc/smb.conf.%m # Some defaults for winbind (make sure you're not using the ranges # for something else.) ; idmap uid = 10000-20000 ; idmap gid = 10000-20000 ; template shell = /bin/bash # Setup usershare options to enable non-root users to share folders # with the net usershare command. # Maximum number of usershare. 0 (default) means that usershare is disabled. ; usershare max shares = 100 # Allow users who've been granted usershare privileges to create # public shares, not just authenticated ones usershare allow guests = yes
dufasbl-150

2019/05/21 09:43 編集

(1) path を外付けHDDではなく、ローカルのディレクトリにした場合、どうなるか →なにもエラーを出さずにフォルダーを表示してくれました。外付けHDDにもどすと、質問と同じエラーがでます。 (2) Windows ではなく、raspberrypi の端末から smbclient コマンドで接続した場合、どうなるか   →raspberrypiの端末がsambaサーバとして使用している端末1台しかないため、試すことができませんでした。申し訳ありません。
TaichiYanagiya

2019/05/21 13:25

情報ありがとうございます。 smb.conf は、できれば質問文を編集して追記ください。 また、smbclient は Samba サーバーと同一ホストから "smbclient //127.0.0.1/pi -U (ユーザー名)" で構いません。
guest

回答1

0

ベストアンサー

ローカルのディレクトリにした場合、成功することから、/media/pi/ハードディスク名/フォルダ名/ の途中のディレクトリのパーミッションに問題があるのではないでしょうか。

ls -ld /media/pi/ハードディスク名/フォルダ名/ ls -ld /media/pi/ハードディスク名/ ls -ld /media/pi/ ls -ld /media/

どれか 1つでも o+rx 権限が抜けていると、アクセスできません。

投稿2019/05/21 13:25

TaichiYanagiya

総合スコア12146

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

dufasbl-150

2019/05/22 11:50

ご回答ありがとうございます。パーミッションを確認し変更したところ、パスワード認証でHDDのなかのフォルダーを表示することができました。しかし、フォルダーの作成をしようとすると「対象のフォルダーへのアクセスは拒否されました」というタイトルのエラーメッセージが表示されます。パーミッションは7(内容の変更は可)に設定しています。どうしたらフォルダーの作成(内容の変更)ができるようになるのでしょうか。
TaichiYanagiya

2019/05/22 12:29

/media/pi/ハードディスク名/フォルダ名/ が 777 ならば作成できるはずですが、smbclient ではどうなるでしょうか?
dufasbl-150

2019/05/23 09:21 編集

smbclientで試してみました。 mkdir test と入力したところ、 NT_STATUS_ACCESS_DENIED making remote directory \test と表示され、フォルダーは作成されていませんでした。一度パーミッションが本当に 777 なのか確認したところ、 755 になっていました。そこで sudo chmod を使い 777 にしようとしましたが反映されません(10回やっても20回やっても 755 )。反映させるには設定(?)をする必要があるのですか?
TaichiYanagiya

2019/05/23 09:23

ファイルシステムが FAT32 とのことですので、マウントオプション uid, gid, umask でパーミッションが決まります。 chmod では変更できません。 マウントオプションを確認ください。
dufasbl-150

2019/05/25 12:44 編集

返信遅れてすいません。パスワード認証で表示させる、フォルダーの読み書きが自由にできるようにする、この2つを解決することができました。詳しく教えていただき本当にありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問