4

On our Centos 7 server, I added create mask = 770 to my smb.conf in order to force permissions on the files our Windows users store in a directory. Then from the command line, I entered the following:

# systemctl restart smb.service

# systemctl restart nmb.service

...but the files were not saved with the right permissions. They were saved correctly after a reboot. So what happened in the reboot that (maybe) I could have done from the command line?

Here's the section of the smb.conf:

[image-storage]
     comment = archived image location
     path = /our/samba/path/to/image_storage
     valid users = @NameOfOurGroup
     create mask = 770
     browsable = yes
     writable = yes
     guest ok = no
     force user = imagestore
Paris Finley
  • 41
  • 1
  • 1
  • 4

4 Answers4

13

Restarting just the service seems like an improvement on rebooting. Even better still is to make use of the config reload that comes with many linux services, including Samba. This feature is often accessed with a SIGHUP signal or via a control program.

Use smbcontrol (man page) to reload the config with the lowest downtime and lowest-possible impact on services already using your shares. So, just run this:

smbcontrol smbd reload-config
Bill Huneke
  • 231
  • 2
  • 4
  • 1
    I had added a new share to the `smb.conf` and tried the command you wrote (prefixed with `sudo`). Unfortunately, the new share did not appear. I had to restart the service, then it appeared. – Damn Vegetables Nov 09 '20 at 10:31
  • Without reboot it works but with `rm -R /var/cache/samba/*` like @Tox said here https://askubuntu.com/a/872460/972235 – phili_b May 05 '22 at 14:34
1

You have the name of the service wrong. Try:

# systemctl restart smb.service
# systemctl restart nmb.service
Jim L.
  • 645
  • 4
  • 10
  • I've edited the question to reflect this. This also fails in exactly the same way. Restarting samba does not seem to affect the image_storage directory. – Paris Finley Jul 23 '19 at 12:08
  • my system doesn't even know smb.service or nmb.service but still it has a smb.conf file and reachable shares – bvdb Sep 23 '21 at 15:21
  • on my system it is actually `systemctl restart smbd.service` and `systemctl restart nmbd.service` if you don't know the name of the service try : `systemctl | grep mb` and you may find it – bvdb Sep 23 '21 at 15:23
  • be sure you want to restart the smb service before using this answer, it will kick connected users. Better to use `smbcontrol smbd reload-config` if you just want to reload new shares or update config. – PrestonDocks Jan 08 '22 at 00:52
0

Samba creates a child processes for each connected user. According to the manual the parent process monitors the config file and automatically reloads it if it changes. So your changes are acted on almost instantly without your doing anything, however the changes are not propagated to the current crop of child processes.

Any new user mounting shares will see your changes.

If you wish to see them

  • Dismount all your samba shares from your windows machine. Your child process on the samba server will die when your last share is unmounted. Mounting a drive creates a new child process with the new settings
  • Or kill your samba child process.
ferg
  • 21
  • 4
0

This line

# chcon -Rt samba_share_t /our/samba/path/to/image_storage

fixed the issue without a reboot. As it was explained to me, this line informs SELinux that the share exists.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79
Paris Finley
  • 41
  • 1
  • 1
  • 4