macOS File Sharing – Unable to Select Sharing Only User

file-sharingmacossonoma

I have this weird issue on Sonoma where after creating a sharing-only user I'm unable to select it under Windows File Sharing. Instead I only see an entry for my main account (+ other Standard/Admin accounts), which is sometimes duplicated:

enter image description here

enter image description here

Creating a second sharing-only account just results in yet another duplicate of my main, and so on:

enter image description here

enter image description here

This occurred both before and after a full factory reset (OS + data).

Best Answer

I reproduced your issue on two machines (one physical and one virtual), so what you're experiencing is not unique to your system.

However, I figured out a solution to this, and it involves doing something that Allan recommended, however as you pointed out that is impossible ...

unless:

This example assumes a share-only user named "d" has been created. Run the following in Terminal:

sudo mkdir /Users/d
sudo chown d /Users/d
sudo dscl . -change /Users/d UserShell "/usr/bin/false" "/bin/zsh"
sudo dscl . -change /Users/d NFSHomeDirectory "/dev/null" "/Users/d"

Now you can log in as that user:

su d

Enter in the password you set when creating that user, and you should get a shell as that user.

exit

Now go into your settings and you should see that user in the Windows File Sharing list. Note that all those extra duplicate users that you currently see in that list will vanish once you reboot.

Once you've confirmed that you can see the user and have enabled Windows File Sharing, you can reverse the changes you needed to log in as that user:

sudo dscl . -change /Users/d NFSHomeDirectory "/Users/d" "/dev/null"
sudo dscl . -change /Users/d UserShell "/bin/zsh" "/usr/bin/false"
sudo rm -rf /Users/d

That should put the user back into the same "ShareOnly" state that you started with.