Mate 19 Samba kicking my butt!

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
bhoth
Level 1
Level 1
Posts: 19
Joined: Fri Nov 04, 2011 9:17 am

Mate 19 Samba kicking my butt!

Post by bhoth »

Hi All,

I am a long time Linux Mint user and created many scripts years ago to help me setup a new version when released. One of the scripts I created was setting up Samba.

Here is the script:

sudo apt-get install samba
sudo /etc/init.d/smbd stop
sudo /etc/init.d/nmbd stop
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.template
sudo cp -f /home/data/scripts/samba/smb.conf /etc/samba
sudo chmod 0777 /home/data
sudo /etc/init.d/smbd start
sudo /etc/init.d/nmbd start
#sudo smbpasswd -L -a bhoth
#sudo smbpasswd -L -e bhoth
echo "Done"

Here is a copy of my smb.conf

[global]
; General server settings
netbios name = Home
server string =
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
workgroup = HOTH
preferred master = Yes
hosts allow = 192.168.4
disable netbios = yes
dns proxy = no
security = user
passdb backend = tdbsam
encrypt passwords = true
username map = /etc/samba/smbusers.txt
name resolve order = lmhosts wins host bcast

wins support = no

; printing = CUPS
; printcap name = CUPS


[data]
path = /home/data/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = bhoth
force group = bhoth

Here is a copy of running testparm

bhoth@Home:~$ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[data]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
disable netbios = Yes
dns proxy = No
log file = /var/log/samba/log.%m
max log size = 1000
preferred master = Yes
security = USER
server string =
syslog = 0
username map = /etc/samba/smbusers.txt
workgroup = HOTH
idmap config * : backend = tdb
hosts allow = 192.168.4


[data]
create mask = 0644
force group = bhoth
force user = bhoth
path = /home/data/
read only = No
bhoth@Home:~$ ^C
bhoth@Home:~$

But now when I try to connect from any other computer in the house on the same 192.168.4 subnet, access is denied. The firewall on Home has been disabled.

Here is a portion of the log. I do see a problem that the usermap file does not exist: Why would Samba not have rights to create the usermap file? It always has before.

can't open username map /etc/samba/smbusers.txt. Error No such file or directory
[2018/07/02 13:55:15.233346, 0] ../lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon 'smbd' finished starting up and ready to serve connections
[2018/07/02 13:59:04.746002, 0] ../lib/util/access.c:365(allow_access)
Denied connection from 192.168.4.49 (192.168.4.49)
[2018/07/02 13:59:04.752443, 0] ../lib/util/access.c:365(allow_access)
Denied connection from 192.168.4.49 (192.168.4.49)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Mate 19 Samba kicking my butt!

Post by altair4 »

May I ask why you need a username map file? You aren't using it or else you would have noticed that it didn't exist when you tried to edit the file. Samba will not create that file by itself.

You created a share that required credentials to access but the only reference to adding any of your users to the samba password database is commented out:
#sudo smbpasswd -L -a bhoth
#sudo smbpasswd -L -e bhoth
This is nitpicking but you may want to change your script to reflect where we are these days. SysV ( sudo /etc/init.d/smbd stop ) was replaced by Upstart ( sudo service smbd stop ) which was replaced by today's systemd ( sudo systemctl stop smbd ). Any of them will work but I have to admit I didn't think the old init.d command would work anymore until I tried it .

Another nitpick: You don't need to restart nmbd because you disabled netbios in your smb.conf file ( disable netbios = Yes ).
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
bhoth
Level 1
Level 1
Posts: 19
Joined: Fri Nov 04, 2011 9:17 am

Re: Mate 19 Samba kicking my butt!

Post by bhoth »

I had the username password commented out temporarily:

Here is what I have now for the script:

sudo apt-get install samba
sudo systemctl stop smbd
sudo systemctl stop nmbd
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.template
sudo cp -f /home/data/scripts/samba/smb.conf /etc/samba
sudo chmod 0777 /home/data
sudo systemctl start smbd
sudo smbpasswd -L -a bhoth
sudo smbpasswd -L -e bhoth
echo "Done"

When using this script, I still don't get a usermap file created and still get access denied from any other client.

I also changed the location of the user map file to a location with user level rights and still get the same result in the smb.conf

[global]
; General server settings
netbios name = Home
server string =
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
workgroup = HOTH
preferred master = Yes
hosts allow = 192.168.4
disable netbios = yes
dns proxy = no
security = user
passdb backend = tdbsam
encrypt passwords = true
username map = /home/data/scripts/samba/smbusers
name resolve order = lmhosts wins host bcast

wins support = no

; printing = CUPS
; printcap name = CUPS


[data]
path = /home/data/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = bhoth
force group = bhoth
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Mate 19 Samba kicking my butt!

Post by altair4 »

This is the wrong syntax:
hosts allow = 192.168.4
Put a period at the end:
hosts allow = 192.168.4.
reststart smbd
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
bhoth
Level 1
Level 1
Posts: 19
Joined: Fri Nov 04, 2011 9:17 am

Re: Mate 19 Samba kicking my butt!

Post by bhoth »

Ok I changed the Hosts back to 192.168.4. ( I am confused about this as my original smb.conf had it that way but testparm flagged it as an issue, now it works fine)

Now I can see the share and login to it but it is read only.

Current log file shows this:

[2018/07/03 12:17:26.517270, 0] ../source3/auth/user_util.c:371(map_username)
can't open username map /home/data/scripts/samba/smbusers. Error No such file or directory
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Mate 19 Samba kicking my butt!

Post by altair4 »

[1] What is the contents of your username map file:

Code: Select all

cat /home/data/scripts/samba/smbusers
[2] And what are the permissions of the shared folder:

Code: Select all

ls -dl /home/data
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
bhoth
Level 1
Level 1
Posts: 19
Joined: Fri Nov 04, 2011 9:17 am

Re: Mate 19 Samba kicking my butt!

Post by bhoth »

altair4 wrote: Tue Jul 03, 2018 3:22 pm [1] What is the contents of your username map file:

Code: Select all

cat /home/data/scripts/samba/smbusers
[2] And what are the permissions of the shared folder:

Code: Select all

ls -dl /home/data
This is what I posted from the log above. The usermap file is not being created. I don't know why. It's not a permissions issue.

bhoth@Home:~$ cat /home/data/scripts/samba/smbusers
cat: /home/data/scripts/samba/smbusers: No such file or directory
bhoth@Home:~$

bhoth@Home:~$ ls -dl /home/data
drwxrwxrwx 22 bhoth bhoth 4096 Jul 12 2017 /home/data
bhoth@Home:~$
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Mate 19 Samba kicking my butt!

Post by altair4 »

Why not create the username map file so you can stop the error messages:

Code: Select all

touch /home/data/scripts/samba/smbusers
Samba will not create this file by itself just because it appears in smb.conf.

As for the read only access of the share of /home/data ... I have no idea at the moment. I suppose you could have read only access to a file or folder within /home/data but I don't see where you can't add a file to it.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
bhoth
Level 1
Level 1
Posts: 19
Joined: Fri Nov 04, 2011 9:17 am

Re: Mate 19 Samba kicking my butt!

Post by bhoth »

I created the usermap file as you suggested and still the same result.

I am considering formatting and starting over.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Mate 19 Samba kicking my butt!

Post by altair4 »

If you are considering a reinstall I would suggest using the default smb.conf as it is when you install samba.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
bhoth
Level 1
Level 1
Posts: 19
Joined: Fri Nov 04, 2011 9:17 am

Re: Mate 19 Samba kicking my butt!

Post by bhoth »

I just completed a format and re-install and now Samba works just fine with my smb.conf file. Don't know what I did before but I must have messed it up somehow.

Thanks all for your time
Locked

Return to “Networking”