This article describe how to install samba and access to samba server from Windows 10.
IP address of samba server is 192.168.11.66.
Table of Contents
1 Install samba
Install samba with apt.
$ sudo apt install -y samba
2 pdbedit
Add user access to samba with pdbedit.
$ sudo pdbedit -a hiroom2 new password: retype new password:
3 /etc/samba/smb.conf
This article show how to share home directory for each user and share directory with multiple user.
Please reboot smbd and nmbd after editing smb.conf.
$ sudo systemctl restart smbd nmbd
3.1 Share home directory for each user
Share home directory for each user added by pdbedit.
When access hiroom2's home directory "\\192.168.11.66\hiroom2", %s at valid users will be "hiroom".
Only user hiroom2 can access to hiroom2's home directory.
$ diff -uprN /etc/samba/smb.conf{.org,} --- /etc/samba/smb.conf.org 2016-05-10 09:12:05.384991245 +0900 +++ /etc/samba/smb.conf 2016-05-10 09:27:31.371397316 +0900 @@ -190,13 +190,13 @@ # Un-comment the following (and tweak the other settings below to # suit) # to enable the default home directory shares. This will share each # user's home directory as \\server\username -;[homes] -; comment = Home Directories -; browseable = no +[homes] + comment = Home Directories + browseable = no # By default, the home directories are exported read-only. Change the # next parameter to 'no' if you want to be able to write to them. -; read only = yes + read only = no # File creation mask is set to 0700 for security reasons. If you want # to # create files with group=rw permissions, set next parameter to 0775. @@ -211,7 +211,7 @@ # Un-comment the following parameter to make sure that only # "username" # can connect to \\server\username # This might need tweaking when using external authentication schemes -; valid users = %S + valid users = %S # Un-comment the following and create the netlogon directory for # Domain Logons # (you need to configure Samba to act as a domain controller too.)
3.2 Share directory with multiple user.
Share permission 0777 directory with multiple user adde by pdbedit.
$ diff -uprN /etc/samba/smb.conf{.org,} --- /etc/samba/smb.conf.org 2016-05-10 09:38:31.909847328 +0900 +++ /etc/samba/smb.conf 2016-05-10 09:46:25.758629642 +0900 @@ -187,6 +187,14 @@ #======================= Share Definitions ======================= +[share] + comment = Share directory + path = /var/lib/share + read only = no + guest only = no + guest ok = no + share modes = yes + # Un-comment the following (and tweak the other settings below to # suit) # to enable the default home directory shares. This will share each # user's home directory as \\server\username
Change /var/lib/share's permission to 0777.
$ sudo mkdir /var/lib/share $ sudo chmod 0777 /var/lib/share
4 Access to samba from Windows 10
Access to \\192.168.11.66\hiroom2 with explorer.
Input username and password as same as pdbedit.
Accessed to hiroom2's home directory.
4.1 Map network drive
If mapping network drive, windows 10 will connect to samba automatically when user login.
Move to PC directory in explorer, Select "Map Network drive".
This time, mapping to \\192.168.11.66\share.
Network drive is mapped to samba share directory.