Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Why can't I access File Sharing when Open Directory is enabled in macOS Mojave?

Here's the procedure I have followed:

  1. Install a fresh copy of macOS Mojave to an APFS volume
  2. Perform initial OS configuration and create 'admin' user at first launch. Assign a static IP from 192.168.168.0/24 private network. Use a DNS server located in private network. Ensure IP resolves to a FQDN ('test.mydomain.com') and vice versa.
  3. Download macOS Server application (5.7) from App Store
  4. Open macOS Server application
  5. Create a new Open Directory domain with default options
  6. Create a new user 'testuser' to Local Network Directory
  7. Create a new group 'testgroup' to Local Network Directory
  8. Assign newly created 'testuser' to 'testgroup'
  9. Open System Preferences application
  10. Open Sharing preferences
  11. Enable File Sharing
  12. Create a Shared Folder 'myshare' and assign 'testgroup' and 'admin' Read&Write access to it
  13. Select 'myshare' and click Options button to ensure SMB sharing is enabled for it
  14. Attempt to connect to the file server from a client computer within the same subnet via smb://test.mydomain.com/myshare or alternatively smb://192.168.168.X/myshare either using 'admin' or 'testuser' credentials

In the last step connection fails for both 'admin' and 'testuser' accounts. If I turn Open Directory to Off, I can connect with 'admin' user. Restarts in any phase of the procedure make no difference.

Why can't I access SMB when Open Directory is enabled?

Here are the opendirectoryd log entries from creating the OD master (step 5): https://pastebin.com/uQm8b8NM

Here are the opendirectoryd and smbd log entries from login attempt (step 14): https://pastebin.com/U2RS3LYC & https://pastebin.com/7bFNfd8V

Mac mini, macOS Mojave (10.14)

Posted on Oct 28, 2018 2:48 AM

Reply
Question marked as Best reply

Posted on Nov 28, 2018 7:23 PM

Hi all.


I posted the follow answer on Ask Different to this same question there. Hopefully it'll help.


The issue is the ACLs are not set up in the local directory for SMB and AFP. These used to be created in the older Server apps that had File Sharing in them. I've written an AppleScript that takes care of all this. It creates the appropriate ACL groups in the directory (/Local/Default/Groups/com.apple.access_smb and com.apple.access_afp), then adds all the users to it. The script is below. I threw it together today trying to solve this very issue. Hopefully it will help others.


-- Script to sort out ACLs for file sharing

set savedDelimiters to AppleScript's text item delimiters



display alert "Setup File Sharing ACLs" message "This script will set up the appropriate ACLs in the local directory to allow users to connect to file sharing on a macOS 10.14 server with OpenDirectory.



WARNING: Changes will be made to your local directory. Administrator privileges are required (you will be prompted for a password).



USE AT YOUR OWN RISK!



Set for all users, or only a single user?" buttons {"Cancel", "All Users", "Single User"} default button "Single User" cancel button "Cancel"



if button returned of result = "All Users" then

set progress description to "Loading User List..."

-- Load all directory users from the server

-- (identified by UserShell value of '/bin/bash'; most likely to be normal users)

-- The delimiter is horrible, but it's the only way to do it

set delimiter to tab & tab & "UserShell = (" & return & " \"/bin/bash\"" & return & ")"

set AppleScript's text item delimiters to {delimiter & return, delimiter}

set users to every text item of (do shell script "dscl /LDAPv3/127.0.0.1 search /Users UserShell \"/bin/bash\"")

else if button returned of result = "Single User" then

repeat

set username to the text returned of (display dialog "Enter Username:" default answer "" with icon note)

if username is "" then

display alert "Please enter username, or click cancel to end"

else

exit repeat

end if

end repeat

-- Add blank element to end, as this happens with output from dscl above

set users to {username, ""}

end if



-- Create the SMB & AFP ACL groups if necessary (this may be the first user)

createACLGroup("afp", 250)

createACLGroup("smb", 110)

-- Go through all the users now

set total to (length of users) - 1

set progress total steps to total

set progress description to "Adding Users to ACLs..."

set current to 0

repeat with idx from 1 to total

-- Need to use indexed repeat because of issue with missing username in list from dscl

set username to item idx of users

try

set progress completed steps to current

set progress additional description to "User " & (current + 1) & " of " & total & " (" & username & ")"

-- Now, check to see if the user is already in the file sharing lists

set AppleScript's text item delimiters to {" "} -- Split words, not letters!

set currList to every text item of (do shell script "dscl /Local/Default read Groups/com.apple.access_smb GroupMembership")

if username is in currList and length of users is 1 then

-- Only alert if in single user mode

display alert "Username already set up"

else

-- Go ahead and set it up

-- Firstly, get the user's GeneratedUID from the LDAP directory

set isError to false

try

set guid to second item of (every text item of (do shell script "dscl /LDAPv3/127.0.0.1 read Users/" & username & " GeneratedUID"))

on error

display alert "Error" message "User " & username & " is not a directory user"

set isError to true

end try

if not isError then

-- Add the user to the group

addUserToACL("afp", username, guid)

addUserToACL("smb", username, guid)

end if

end if

set current to current + 1

on error

-- Likely an empty username from the delimiters tokenising the list from dscl

end try

end repeat

set current to total

display alert "Process completed!"



set AppleScript's text item delimiters to savedDelimiters



on createACLGroup(acltype, groupid)

try

do shell script "dscl /Local/Default read Groups/com.apple.access_smb"

on error

-- Doesn't exist, so we need to create it!

do shell script "dscl /Local/Default create Groups/com.apple.access_" & acltype with administrator privileges

do shell script "dscl /Local/Default create Groups/com.apple.access_" & acltype & " RealName \"" & changeCaseOfText(acltype, "upper") & " ACL\"" with administrator privileges

do shell script "dscl /Local/Default create Groups/com.apple.access_" & acltype & " PrimaryGroupID " & groupid with administrator privileges

end try

end createACLGroup



on addUserToACL(acltype, username, guid)

do shell script "dscl /Local/Default append Groups/com.apple.access_" & acltype & " GroupMembership " & username with administrator privileges

do shell script "dscl /Local/Default append Groups/com.apple.access_" & acltype & " GroupMembers " & guid with administrator privileges

end addUserToACL



on changeCaseOfText(theText, theCaseToSwitchTo)

if theCaseToSwitchTo contains "lower" then

set theComparisonCharacters to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

set theSourceCharacters to "abcdefghijklmnopqrstuvwxyz"

else if theCaseToSwitchTo contains "upper" then

set theComparisonCharacters to "abcdefghijklmnopqrstuvwxyz"

set theSourceCharacters to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

else

return theText

end if

set theAlteredText to ""

repeat with aCharacter in theText

set theOffset to offset of aCharacter in theComparisonCharacters

if theOffset is not 0 then

set theAlteredText to (theAlteredText & character theOffset of theSourceCharacters) as string

else

set theAlteredText to (theAlteredText & aCharacter) as string

end if

end repeat

return theAlteredText

end changeCaseOfText

14 replies
Question marked as Best reply

Nov 28, 2018 7:23 PM in response to Hans Vallden

Hi all.


I posted the follow answer on Ask Different to this same question there. Hopefully it'll help.


The issue is the ACLs are not set up in the local directory for SMB and AFP. These used to be created in the older Server apps that had File Sharing in them. I've written an AppleScript that takes care of all this. It creates the appropriate ACL groups in the directory (/Local/Default/Groups/com.apple.access_smb and com.apple.access_afp), then adds all the users to it. The script is below. I threw it together today trying to solve this very issue. Hopefully it will help others.


-- Script to sort out ACLs for file sharing

set savedDelimiters to AppleScript's text item delimiters



display alert "Setup File Sharing ACLs" message "This script will set up the appropriate ACLs in the local directory to allow users to connect to file sharing on a macOS 10.14 server with OpenDirectory.



WARNING: Changes will be made to your local directory. Administrator privileges are required (you will be prompted for a password).



USE AT YOUR OWN RISK!



Set for all users, or only a single user?" buttons {"Cancel", "All Users", "Single User"} default button "Single User" cancel button "Cancel"



if button returned of result = "All Users" then

set progress description to "Loading User List..."

-- Load all directory users from the server

-- (identified by UserShell value of '/bin/bash'; most likely to be normal users)

-- The delimiter is horrible, but it's the only way to do it

set delimiter to tab & tab & "UserShell = (" & return & " \"/bin/bash\"" & return & ")"

set AppleScript's text item delimiters to {delimiter & return, delimiter}

set users to every text item of (do shell script "dscl /LDAPv3/127.0.0.1 search /Users UserShell \"/bin/bash\"")

else if button returned of result = "Single User" then

repeat

set username to the text returned of (display dialog "Enter Username:" default answer "" with icon note)

if username is "" then

display alert "Please enter username, or click cancel to end"

else

exit repeat

end if

end repeat

-- Add blank element to end, as this happens with output from dscl above

set users to {username, ""}

end if



-- Create the SMB & AFP ACL groups if necessary (this may be the first user)

createACLGroup("afp", 250)

createACLGroup("smb", 110)

-- Go through all the users now

set total to (length of users) - 1

set progress total steps to total

set progress description to "Adding Users to ACLs..."

set current to 0

repeat with idx from 1 to total

-- Need to use indexed repeat because of issue with missing username in list from dscl

set username to item idx of users

try

set progress completed steps to current

set progress additional description to "User " & (current + 1) & " of " & total & " (" & username & ")"

-- Now, check to see if the user is already in the file sharing lists

set AppleScript's text item delimiters to {" "} -- Split words, not letters!

set currList to every text item of (do shell script "dscl /Local/Default read Groups/com.apple.access_smb GroupMembership")

if username is in currList and length of users is 1 then

-- Only alert if in single user mode

display alert "Username already set up"

else

-- Go ahead and set it up

-- Firstly, get the user's GeneratedUID from the LDAP directory

set isError to false

try

set guid to second item of (every text item of (do shell script "dscl /LDAPv3/127.0.0.1 read Users/" & username & " GeneratedUID"))

on error

display alert "Error" message "User " & username & " is not a directory user"

set isError to true

end try

if not isError then

-- Add the user to the group

addUserToACL("afp", username, guid)

addUserToACL("smb", username, guid)

end if

end if

set current to current + 1

on error

-- Likely an empty username from the delimiters tokenising the list from dscl

end try

end repeat

set current to total

display alert "Process completed!"



set AppleScript's text item delimiters to savedDelimiters



on createACLGroup(acltype, groupid)

try

do shell script "dscl /Local/Default read Groups/com.apple.access_smb"

on error

-- Doesn't exist, so we need to create it!

do shell script "dscl /Local/Default create Groups/com.apple.access_" & acltype with administrator privileges

do shell script "dscl /Local/Default create Groups/com.apple.access_" & acltype & " RealName \"" & changeCaseOfText(acltype, "upper") & " ACL\"" with administrator privileges

do shell script "dscl /Local/Default create Groups/com.apple.access_" & acltype & " PrimaryGroupID " & groupid with administrator privileges

end try

end createACLGroup



on addUserToACL(acltype, username, guid)

do shell script "dscl /Local/Default append Groups/com.apple.access_" & acltype & " GroupMembership " & username with administrator privileges

do shell script "dscl /Local/Default append Groups/com.apple.access_" & acltype & " GroupMembers " & guid with administrator privileges

end addUserToACL



on changeCaseOfText(theText, theCaseToSwitchTo)

if theCaseToSwitchTo contains "lower" then

set theComparisonCharacters to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

set theSourceCharacters to "abcdefghijklmnopqrstuvwxyz"

else if theCaseToSwitchTo contains "upper" then

set theComparisonCharacters to "abcdefghijklmnopqrstuvwxyz"

set theSourceCharacters to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

else

return theText

end if

set theAlteredText to ""

repeat with aCharacter in theText

set theOffset to offset of aCharacter in theComparisonCharacters

if theOffset is not 0 then

set theAlteredText to (theAlteredText & character theOffset of theSourceCharacters) as string

else

set theAlteredText to (theAlteredText & aCharacter) as string

end if

end repeat

return theAlteredText

end changeCaseOfText

Oct 28, 2018 6:19 AM in response to Hans Vallden

The package you’re using here is an MDM server, and bears little relationship to what Server.app was providing prior to Mojave.


In this case, you might try binding the local system to the domain and see if that helps, though I’d probably look to replace the use of Server.app entirely, save as an MDM tool.


I’d probably look to a NAS box as a more capable alternative, and some of those can tie into LDAP. Wouldn’t be surprised to learn some NAS boxes can serve LDAP, too.

Nov 4, 2018 5:36 AM in response to Hans Vallden

I am facing the same problem with 10.14.1 and server 5.7.1. With enabled open directory I cannot access shares with local and OD users. If I activate the windows file sharing checkbox for a local user in the spring options I am able to connect with this user. As OD users are not shown there this is no workaround for me.


Has anyone an idea how to solve this problem? The same setup with Sierra worked without problems.

Nov 4, 2018 6:38 AM in response to admin232

admin232 wrote:


I am facing the same problem with 10.14.1 and server 5.7.1. With enabled open directory I cannot access shares....


Has anyone an idea how to solve this problem? The same setup with Sierra worked without problems.


Contact Apple Support directly, or log feedback.


Otherwise...


Wipe and upgrade to the earlier version of macOS and Server.app in the shorter term, then longer-term either Apple fixes this and related, or as folks migrate to a functional server environment.


Server is utterly misnamed as it presently exists, as it is an MDM package. Not a server.


I’m expecting most of us that used Server will be migrating over the next several years, and I’m certainly not inclined to migrate to an environment where I will need to manually maintain and update the pieces of a hand-rolled server environment atop macOS as Apple has suggested in its migration documentation. Which means either another OS, lr hosting the required services.


For an alternative to local LDAP, have a look at Microsoft Azure Active Directory; Azure AD.

Nov 19, 2018 5:57 AM in response to Hans Vallden

I am facing the same problem with 10.14.1 and server 5.7.1. with OpendirectoryMaster turned on.


When I just turn on FileSaharig over AFP anything works fine.


Also a second Server can connect to OpenDirectoryServer without problems.

User and groups are abloe to connect to the second Server ober AFP.


As soon I turn on SMB and AFP, or only SMB on any of my two servers, it is not possible to login to any Share.

Dec 12, 2018 6:38 AM in response to Hans Vallden

It seems to me this is a clear bug in Mojave or macOS Server application 5.7.


There is no server package 5.71. There is an unfortunately-misnamed MDM package.


Server. Is. Dead.


Few that were using server like this, and we’re either rolling our own server distros atop macOS, migrating to Kerio or such where that works, or we’re migrating to a server on a different operating system platform.



Dec 18, 2018 3:00 PM in response to stephen2011

yes stop using apple server it rubbish dose not work and has zero use.


I would look at getting a QNAP or some other NAS device that has LDAP built in. Or move to LDAP on Linux or if you really want to go mad you could go down the windows route.


For what ever reason windows gets more love off apple than their own server app.


Why can't I access File Sharing when Open Directory is enabled in macOS Mojave?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.