LoginSignup
2
1

Ubuntu22.04 で フルアクセス共有フォルダを samba で作成する

Last updated at Posted at 2022-08-10

Ubuntu のファイルを samba 経由で Windows PC に共有する
GUI の方が簡単だろうけれども、今回は CUI で。
さくっと共有するようにしたメモ。

共有方針

  • Windows からアクセス
  • 認証なしでフルアクセス共有
  • ワークグループ共有

環境

  • サーバ Ubuntu22.04 LTS AMD64
  • クライアント Windows10 Pro 21H2

samba インストールと設定

インストール

$ sudo apt update
$ sudo apt install samba smbclient cifs-utils

共有場所をサーバ内ローカルストレージ内に作成

$ sudo mkdir /samba
$ sudo chmod 777 /samba

samba.conf を設定し、サーバサービスに反映

$ sudo vim /etc/samba/smb.conf

[global] に以下のように追記

unix charset = UTF-8
dos charset = CP932

interfaces = 127.0.0.0/8 eth0
とあるところを自分のネットワークに合わせて以下のように書き足し

;   interfaces = 127.0.0.0/8 eth0
interfaces = 127.0.0.0/8 192.168.42.0/24

以下のようになっているのを確認

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user

ファイルの最後に共有ポイントを以下のように追記 ここでは 「dekopon」という名前にしました。

[dekopon]
   path = /samba
   writable = yes
   guest ok = yes
   guest only = yes
   force create mode = 777
   force directory mode = 777

反映

$ sudo service smbd restart
$ sudo service nmbd restart

設定のチェック

$ testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed
WARNING: The 'netbios name' is too long (max. 15 chars).

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

今回はこのまま公開します

動作チェック

MS-Windows から、 \\192.168.42.100 を開けると dekopon が見えます。
image.png

トラブルシューティング

image.png

こうなったとき、よく見たら、 smb.conf の中身がミスタイプでした。

[dekopon]
   path = /samba
   writable = yes
   guset ok = yes
   gest only = yes
   force create mode = 777
   force directory mode = 777
2
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
2
1