Working Windows-based solution
I've got a folder on a network share which works great in Windows. It is basically an index of other available file servers. It looks something like this:
\\server1\directory Server2.lnk <-(links to \\server2\files) Server3.lnk <-(links to \\server3\files) Server4.lnk <-(links to \\server4\files)
I'm trying to replicate this functionality in macOS, but I have run into these problems:
Attempting to use an Alias in macOS
I connected to
Go -> Connect to Server. Once I was connected in
Finder, I created an
Alias using for the
//server2/files folder. I then copied that
Alias to the
//server1/directory location. The
Alias works... as long as I'm using the same computer from which I created the
Alias. But if I try to use it from another mac, it fails.
The other mac doesn't even seem to recognize the file as an
Alias file. It has an icon similar to a
terminal icon, and when I double-click it, the mac tells me that there is no Application defined to open the file. I noticed that the original created
Alias file doesn't seem to have any kind of extension, so I'm not sure how a different mac is supposed to recognize it as an
The nice thing about a Windows
.lnk file is that it seems to work reliably and consistently no matter from what machine the
.lnk is accessed, whereas a mac
Alias file seems to somehow depend on some configuration of the original machine where it was created.
For example, if I open the
Alias file in
vi, I can see amongst the garbled code that it includes at least the username used to access the Share, whereas I want each user that clicks on the
Alias to access the Share using their own credentials (the mac is joined to AD and users login using their AD credentials). Again, this works seamlessly with UNC paths and
Attempting to use a terminal script in macOS
I tried to make a simple script that mounts the shares. So inside
//server1/directory I created a file
Server2.command with the following content:
mkdir /Volumes/Server2 mount_smbfs //server2/files /Volumes/Server2 cd /Volumes/Server2 open .
My problem with this solution is that I have many servers and many users using the same machine. One great thing about using the
Connect to Server option in Finder is that it seems to automatically "clean up" the
/Volumes directory. After ejecting a share, or after ending a session, it removes the corresponding
/Volumes/Sharename folder. I don't see any way to accomplish the same behavior if I use this terminal-based solution.
Can someone give me a good way to replicate the
.lnk functionality I have described above?
I know the Windows links functions via UNC paths, whereas in macOS I can only access these network shares via
afp mounts, but since I see that the
Connect to Server option pretty much functions how I need it to, I just need a way to use that same functionality, with the caveat that I need to automate it, because I'm not going to ask my Users (I have many Users using the same machine) to each create a
Connect to Server