Tuesday, February 23, 2016

Recently a user asked about getting Samba working in the Kubuntu IRC channel #kubuntu. The excellent Darin Miller (DarinMiller in irc) helped:

DarinMiller: This website has a good samba overview: https://help.ubuntu.com/community/Samba

Do the following: `sudo apt install samba samba-common system-config-samba python-glade2`

After installing, the user still could not get Samba working, even after creating shared folders and setting  up smdb.conf.

DarinMiller: Add a smb group:  `sudo addgroup smb`, then add yourself to the group: `sudo adduser $USER smb`. Then add yourself as a samba user: `sudo smbpasswd -a $USER`

Enable the user:  `sudo smbpasswd -e $USER`

For the next part, either use the GUI: sudo system-config-samba or, manually edit the smb.conf file: kdesudo kate /etc/samba/smb.conf, and change: workgroup = workgroup to workgroup =

Also, change the resolve order as follows:
name resolve order = bcast host lmhosts wins. Order is very important!

The user asks, "do I have to change the network group name?"
DarinMiller: No, you can leave it as work group.
User: do I have to add that to the config?
DarinMiller: Also,  ensure the "name resolve order" is under the [global] section

User: Ok, let me check my smb.conf
DarinMiller:  Yes, typically "name resolve order" must be manually added to the file. To enable anonymous access to windows machines: remove the ";" (semi-colon) from beginning of line "security = user" and below the "security = user" line add a new line:
 map to guest = Bad User
Specific Folder share example (add at the end of the file): i.e. [Downloads] path = /home//Downloads
 comment = "Some comment"
User: can I pastebin my config file? [ed. Good for User! always pastebin rather than flooding the chan]
DarinMiller: writeable = yes

 DarinMiller: valid users = name1, name2, ....
 browseable = yes
 When the you finish editing the smb.conf file, restart samba: sudo /etc/init.d/samba restart

DarinMiller: Ensure to add: name resolve order = bcast host lmhosts wins in the [global] section...
 And, do you have a /samba/anonymous directory on your box (that's not a default folder)

Checklist: 

  • added the smb user group and your username to the group.
  • Added and enabled your username to the samba group using smbpasswd: `sudo smbpasswd -a``sudo smbpasswd -e`
  • Then, restart samba: `sudo /etc/init.d/samba restart`

Success!

DarinMiller: A couple other good links: http://www.jonathanmoeller.com/screed/?p=2941
http://www.unixmen.com/howto-install-and-configure-samba-share-in-ubuntu/
My personal notes I keep here for a community Ed class I occasionally teach: https://sites.google.com/site/bcelinux/classroom-news/basicsambaconfigurationfilesharingincludingwindowspcs

Folks, this is the awesome support people get in #kubuntu and elsewhere in IRC when they ask their question and wait for an answer.