Allow at sign in SMB username (Microsoft Account)


mgutt

Recommended Posts

As it is more comfortable for the user I like to see this enhancement in Unraid:

 

 

In addition there should be a "change password" page, if the user changed their microsoft password.

 

I already tried to add the at sign to the javascript check when adding a user, but it finally fails with "emhttpd: Invalid user name".

 

Several files contain the username:

grep -sRI --exclude-dir={dev,mnt,msg.sock,proc,run,sys,overlay2} "foobarbaz" /
/etc/shadow:foobarbaz::18988::::::
/etc/passwd:foobarbaz:x:1004:100::/:/bin/false
/etc/shadow-:foobarbaz:!:18988::::::
/etc/samba/smb-shares.conf:     write list = john,foobarbaz
/etc/samba/smb-shares.conf:     valid users = john,foobarbaz
/usr/local/emhttp/state/sec.ini:writeList="john,foobarbaz"
/usr/local/emhttp/state/users.ini:["foobarbaz"]
/usr/local/emhttp/state/users.ini:name="foobarbaz"
/usr/local/emhttp/boot/config/shares/isos.cfg:shareWriteList="john,foobarbaz"
/usr/local/emhttp/boot/config/passwd:foobarbaz:x:1004:100::/:/bin/false
/usr/local/emhttp/boot/config/shadow:foobarbaz::18988::::::
/usr/local/emhttp/boot/config/smbpasswd:foobarbaz:1004:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:[NDU        ]:LCT-00000000:
/boot/config/shares/isos.cfg:shareWriteList="john,foobarbaz"
/boot/config/passwd:foobarbaz:x:1004:100::/:/bin/false
/boot/config/shadow:foobarbaz::18988::::::
/boot/config/smbpasswd:foobarbaz:1004:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:[NDU        ]:LCT-00000000:
/var/local/emhttp/sec.ini:writeList="john,foobarbaz"
/var/local/emhttp/users.ini:["foobarbaz"]
/var/local/emhttp/users.ini:name="foobarbaz"
/var/lib/samba/private/smbpasswd:foobarbaz:1004:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:[NDU        ]:LCT-00000000:

 

Link to comment
  • 3 months later...

How to allow using a Microsoft Account (e.g. [email protected])  to access a share instead of using a Windows Local User?
-> Easy to achieve: ;-)

 

Create a directory/file like this on your Unraid boot stick:
If you do this from the Unraid shell, the owner/group of the file should be root:root with a security mask of 0600 automatically.

 

mkdir /boot/config/custom/etc/samba
nano /boot/config/custom/etc/samba/usermap.txt

 

Remember, the user you want to map to your Windows user has to already exist in Unraid or it has to be created first in the Unraid GUI.

Now that you are in the editor for the file, add a line like the following for every user you want to map.

Unraid(Linux) user on the left, Microsoft Account user on the right:

 

user = [email protected]

 

Save the file and close the editor.

 

Now go to your SMB settings in the GUI and add the following line under the [global] settings configuration of your smb-extra.conf file:

Note: the path and filename must match to what we have created right before... ;-)

 

username map = /boot/config/custom/etc/samba/usermap.txt

 

Now you can either restart your server or go to the shell and just restart your Samba server with:

 

samba restart

 

Now everything should work as expected and you should no longer have a problem to use your [email protected] Microsoft user account to login into your Unraid Samba share.

 

Those who formerly followed the hint to create a local user account under Windows can now revert back to using a Microsoft Account.

Though a Windows local account is less "chatty" with regards to sending data to Microsoft, such an account is also less useful regarding a lot of functions which need to be synced over a cloud-sync sevice.

 

Have fun, with best regards

DaKarli

  • Like 2
  • Thanks 2
Link to comment
  • 8 months later...
On 4/13/2022 at 9:25 AM, DaKarli said:

Now go to your SMB settings in the GUI and add the following line under the [global] settings configuration of your smb-extra.conf file:

 

Can you clarify what's meant by this? On my SMB settings page in the GUI, there is a "SMB Extras" section, and in that section is a text box labeled "Samba extra configuration."

 

Are you saying we should add the following text to that text block?

username map = /boot/config/custom/etc/samba/usermap.txt

 

Or are you saying we need to add a [global] section to that text block, along with the username map, like so:

[global]
username map = /boot/config/custom/etc/samba/usermap.txt

 

Thanks for your help!

Edited by tkohhh
Link to comment
  • 2 months later...
On 12/21/2022 at 1:35 AM, tkohhh said:

Are you saying we should add the following text to that text block?

username map = /boot/config/custom/etc/samba/usermap.txt

 

Or are you saying we need to add a [global] section to that text block, along with the username map, like so:

[global]
username map = /boot/config/custom/etc/samba/usermap.txt

 

Hi tkohhh, sorry for my late reply but I have turned off notifications... ;-)

Maybe you already solved it for yourself but here's an explanation for all:

 

Case A: You already HAVE a [global] block in this configuration, you just add that line to this block.

Case B: If your configuration is empty or missing the [global] block, you add the block AND the line.

🤗

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.