3

I have a number of SMB shares from a macOS host (server) that tend to have very generic names for normal folders such as Downloads or other such folders. I need to be able to identify these on the network as hostname-sharename such that Downloads when mounted on another Mac, Windows or Linux computer should see it available from the macOS host as macpro-downloads for example.

I thought a simple method might be to create a folder such as, from Terminal:

mkdir ~/shares/
cd ~/shares/
ln -s ~/Downloads/ macpro-downloads

But unfortunately this doesn't seem to work since macOS resolves the symlink to the original folder path instead of using the symlink.

What is the preferred method for doing such a thing currently on macOS when hosting SMB shares?

1 Answer 1

3

To rename shares you use the sharing tool and would execute the following in the shell (Terminal.app, etc):

sudo sharing -e current-share-name -S new-share-name

You may also find useful the following (notice the use of the jq tool that you may need to install via MacPorts or Homebrew):

# list all share names (primary macOS host system names):
$ sharing -l -f json | jq 'keys'
[
  ...
  "Downloads",
  "USERNAME",
  "USERNAME’s Public Folder"
  ...
]

# check the settings of "Downloads" share:
$ sharing -l -f json | jq '.Downloads'
{
  "path": "/Users/USERNAME/Downloads",
  "smb_guest_access": 1,
  "smb_name": "hostname-downloads",
  "smb_read_only": 0,
  "smb_sealed": 0,
  "smb_shared": 1
}

# remove guest shared flag of "Downloads" share:
$ sudo sharing -e Downloads -g 000

# again check the settings of "Downloads" share to see guest flag is off:
$ sharing -l -f json | jq '.Downloads'
{
  "path": "/Users/USERNAME/Downloads",
  "smb_guest_access": 0,
  "smb_name": "hostname-downloads",
  "smb_read_only": 0,
  "smb_sealed": 0,
  "smb_shared": 1
}

Notice in the above how listing all shares by their names (keys) in macOS still shows the original name. Basically there are TWO names and Apple would do better calling the name the remote clients see as an alias or "share-name" instead of just "name" so that it's easier to differentiate the internal macOS name vs the share name that clients will see.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .