Samba won't connect and will attempt to restart

Frankly this is a first world issue. But its all open source and seeing as you know about samba authentication try and fix it. :slight_smile:

FYI, this is the format of file in my NAS :

madbrain@server10g:/etc/samba$ cat smbusers 
madbrain = "Firstname Lastname"

Obviously, I replaced my real first name and last name.

This works by having the Unix userid (without spaces) on the left, and the Windows user ID (with spaces) on the right.

The problem with HAOS and the samba add-on is that it appears the add-on creates a new Unix userid on the fly with whatever you type in the username in the configuration. I don’t know if it lets you input an existing userid. And I don’t know what the existing userid to input might be. I have not tried editing smbusers manually, and matching it to the username in the smb.conf add-on to see if that works.

I feel that the proper way to resolve this is for the Samba add-on to create an smbusers file if the username chosen by the user contains any characters that are not allowed as part of Unix userids, such as spaces. This would certainly be way more useful than the current cryptic error message.

If it was written in C or C++, I would fix it myself - unfortunately, I have yet to learn Python, which HomeAssistant is written in, and presumably this add-on as well.

I wouldn’t call it a first-world problem, just a bug report or feature enhancement, depending on how you want to look at it.

I used to know samba quite well, but I have lost quite a lot of it!

However I cannot find any docs on the file smbusers. https://www.samba.org/samba/docs/man/

Any clues?

Sorry, it’s configured in smb.conf
username map points to /etc/samba/smbusers . Or another file of your choice.

https://www.linuxtopia.org/online_books/network_administration_guides/using_samba_book/ch06_02_10.html

Don’t be sorry :slight_smile:
Thanks.

I’ve never seen anyone set up a username with a space in windows in my almost 25 year career, highschool, college, and all my jobs, and the companies I’ve had to visit. It causes problems like this and most people avoid it. Also the onboarding process for windows over the past ~15 years has been to create a username based on your email, which does not include spaces. Of course, I don’t have any data to back this up. I also think you’re the first person to request this on these forums.

As for your problem at hand, you’d have to submit a PR against this file, which uses linux CLI to create the users.

1 Like

As you say, hardly any system(what i know) can handle this unless somehow “converting to Alias or ID’s , somewhere in the process … i guess for same reason “old” blokes still using “standard” naming conventions :slight_smile:
Today’s generation, are many times not even aware of the basics, that still “rules” the world in computer science, i.e disk-sector size, block size ( and how this still"the same” affect performance/space-size) … Dynamic vs GPT, Bios vs UEFI etc.

Yep, you can find a ton of posts across the internet complaining about Microsoft being the only OS that allows spaces in usernames. Granted, the posts are a bit old…

:slight_smile: when i worked with AD and Exchange, people complained about NOT being allowed :grin:
PS: everything else was on Linux, VPN,Firewall, DB, SVN, DNS etc

My career is just as long as yours, if not longer. I have never not had a space in my Windows username. I believe the Windows installer asks for first and last name, and the username with a space is created off of that.

Thank you for the pointer to the source file.

The onboarding for windows definitely builds the username from an email or the entered username. It asks for an online account (email) or a or offline account (name). No last name. I do this quite frequently. You must enter a first and last name for the ‘name’.

I have always done an installation with a local user, not with an email. There are various reasons for that, not least of which that I tend to use uncommon hardware like 10gig NICs that aren’t supported out of the box, and there is no network access at install time until I install the drivers later on.

Yes, that’s the offline option, it only asks for name.

Not wanting to use Microsoft account is another, even if there is network access. So, never done a Windows install with email.

Worked!! Thanks!