13
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Samba4で認証なしで共有フォルダにアクセスさせる

Last updated at Posted at 2015-03-18

windows10からのアクセスは認証が必要になります。

参考

「security=share」の代替としては、「security=user」かつ「map to guest=Bad User」の組み合わせがあります。
この設定では、ユーザ認証でコケたユーザは、guestにマップされるようになります。

インストール

  • fedora22にて確認
yum install samba

設定

/etc/samba/smb.conf
 	security = user
 	passdb backend = tdbsam
+	map to guest=Bad User
/etc/samba/smb.conf
-;	[public]
-;	comment = Public Stuff
-;	path = /home/samba
-;	public = yes
-;	writable = yes
-;	printable = no
-;	write list = +staff
+	[public]
+	comment = Public Stuff
+	path = /srv/samba
+	guest ok = yes
+	public = yes
+	writable = yes
+	printable = no
mkdir /srv/samba
chmod 777 /srv/samba

systemctl start samba

アクセス元を制限する

/etc/samba/smb.conf
 [global]
+  hosts allow = 192.168.100.
  • 192.168.100.0/24 以外からはアクセスできない。

もしくは

/etc/samba/smb.conf
 [global]
+  hosts allow = 192.168.100.0/24 127.0.0.1/32

example

  • /etc/samba/smb.conf
/etc/samba/smb.conf
[global]
    workgroup = WORKGROUP
    encrypt passwords = yes
    netbios name = fileserver
    server string = %h 2020-12-13
    wins support = yes
    log level = 1 
    max log size = 1000
    read only = no
    map to guest = bad user
    username map = /etc/samba/usermap.txt

[share]
   path = /home/share
   public = yes
   writable = yes
   browsable = yes
   create mask = 0644
   directory mask = 0755
   hide files = _recycle

   vfs object = recycle
   recycle:repository = _recycle/%U
   recycle:keeptree = Yes
   recycle:touch = Yes
   recycle:versions = Yes
   recycle:maxsize = 0
   recycle:exclude = Thumbs.db *.tmp *.temp *.o *.obj ~$* *.~?? .DS_Store
   #recycle:exclude_dir = /tmp
   #recycle:noversions = *.doc
  • 全てのリモートユーザーをサーバーの ubuntu ユーザーに割り当てる。
/etc/samba/usermap.txt
ubuntu = *

sambaサーバーのプロトコルバージョン指定

  • samba 4以降対応。samba3はまた別。
[global]
...
   server min protocol = NT1
   server max protocol = SMB3
13
16
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
13
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?