9

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
  • 91
  • 1
  • 1
  • 4

5 Answers5

20

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
1

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
  • 133
1

This answer was by far the best one for me: 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 8, 2022 at 0:52

Matt I.
  • 11
  • 2
1

You have the name of the service wrong. Try:

# systemctl restart smb.service
# systemctl restart nmb.service
Jim L.
  • 665
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
  • 26,582
  • 8
  • 65
  • 97
Paris Finley
  • 91
  • 1
  • 1
  • 4