HOWTO: Getting NAS listed in Shared servers in Finder

Questions regarding MacOSX Specifically can be placed here, such as questions regarding TimeMachine, for example.

Moderators: Synology Inc, Honorary Moderator

HOWTO: Getting NAS listed in Shared servers in Finder

Postby cviebrock » Fri Jun 20, 2008 4:53 pm

If you've got a bit of familiarity with *nix, this isn't that difficult. I've done this on my CS407e, running DSM 2.0-0637.

First, enable SSH on your Synology via Disk Station Manager, then SSH into your NAS as the root user. Password should be the same as the admin password you use to connect to DSM.

The NAS uses mDNSResponder to broadcast Bonjour services. This is the Howl package, which is no longer maintained. When iTunes sharing is enabled, the mDNSResponder is launched; when it's disabled, it's taken down.

Howl uses a configuration file to determine what services to broadcast. It doesn't appear that this file exists anywhere on the NAS, so some other process must be passing the parameters for the iTunes and HTTP (DSM) sharing services. However, if you look at the /usr/syno/sbin/mDNSResponder binary, you can see that it searches for a default configuration file at /etc/howl/mDNSResponder.conf. The "trick" is to create that file, enable iTunes sharing, and presto!

So, SSH to your NAS as the root user. Then the following commands:

Code: Select all
cd /etc
mkdir howl
cd howl


The conf file describes all the services to be broadcast. Like I said, the NAS handles the iTunes and HTTP services, so you just need to list the other ones in this file. Now, create the file:

Code: Select all
vi mDNSResponder.conf


My NAS only comes with the vi editor. vi probably isn't the most intuitive text editor for "newbies" to use. Basically, press "I" to go into insert mode and enter the following text:

Code: Select all
# mDNSResponder conf file
#
# name         type               domain      port      text record
mynas         _ssh._tcp            local.      22       
mynas         _ftp._tcp            local.      21
mynas-afp      _afpovertcp._tcp      local.      548
mynas-smb      _smb._tcp            local.      139


Then, press "ESC" to exit insert mode, and type ":wq" to write your changes and quit.

You can see that I'm broadcasting the SSH service (which would include SFTP), the FTP service, AFP and Samba/CIFS file sharing. Just leave out the ones you don't need, or comment them out with a # at the beginning of the line. You'll note that I've given different names to the AFP and SMB services ... otherwise you'll have two entries in Finder and not know which is which. If you are only using one method to file share, I'd just comment the other one and use the same name. I should point out, if it isn't obvious, that the first column ("name") is what will appear in Finder. You can use longer names with punctuation and spaces if you like, but enclose it all in quotes, i.e.

Code: Select all
"Joe's CS407e"      _afpovertcp._tcp      local.      548


If everything is done correctly, you just need to stop and restart iTunes sharing. I haven't figured out how to get mDNSResponder running without iTunes sharing, so that's the only "quirk" to this process.

Hope that helps everyone!
CS407e
cviebrock
I'm New!
I'm New!
 
Posts: 4
Joined: Fri Jun 20, 2008 5:24 am

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby smoldersonline » Fri Jun 20, 2008 7:10 pm

Thank you very much for this, just brilliant! This would very nicely fit in the Synology Wiki area.
Synology DS509+ with HD103UJ (x3) & HD154UI (x2)
User avatar
smoldersonline
Novice
Novice
 
Posts: 46
Joined: Fri May 02, 2008 7:32 am
Location: The Netherlands

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby seanfitz » Sat Jun 21, 2008 4:12 pm

WOW thank you! :shock: Beautifully complete instructions too for a Unix novice like me. What a quick win - Synology engineers please follow these instructions in next firmware release (the one that fixes AFP...)

To SSH into the Synology box... enable SSH under Network Services > Terminal, then launch Terminal.app on the Mac and type "ssh root@10.0.0.4" (use the IP of your Syno box), then enter your admin password.

And within vi just to clarify for others - that is a capital "i" not lowercase "L" to enter "insert" mode

Lastly, for security go back to the Synology web interface and disable SSH/Telnet under Network Services > Terminal

LOVE IT! My 207+ is finally browsable

And an additional tip - for one-click access, drag the icon from the desktop to the dock - you will be able to click it to mount a share.
seanfitz
Beginner
Beginner
 
Posts: 22
Joined: Sat May 24, 2008 11:31 pm

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby NetBoot » Sun Jun 22, 2008 2:29 pm

Thank you so much for this tip... Just got another Mac with Leopard.

Why Synology didn't tell Franklin how to temporarily fix this issue is beyond me. Why does Synology keep breaking they're own software just freakin' baffles me!

Net....
Product Model: DS-106
Firmware Version: 2.0.3 - 0640

I have my reasons for my insanity....
User avatar
NetBoot
Honorary Moderator
Honorary Moderator
 
Posts: 729
Joined: Tue Oct 24, 2006 8:20 pm
Location: Northeastern U.S.

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby succus » Sun Jun 22, 2008 4:10 pm

This is great. I'll have to give it a try.

NetBoot wrote:...Why does Synology keep breaking they're own software just freakin' baffles me!...


I cannot be more in agreement.
DS207/ST3500630NS/RAID 1/firmware 728
MacOS 10.5.5
succus
Apprentice
Apprentice
 
Posts: 84
Joined: Sat Sep 08, 2007 10:29 pm

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby rabarberski » Sun Jun 22, 2008 5:11 pm

Very nice! And understandable for almost everyone!
I'll give it a try...
rabarberski
Student
Student
 
Posts: 69
Joined: Tue Sep 25, 2007 11:26 am
Location: Belgium

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby madom » Tue Jul 01, 2008 8:35 pm

Works great! Thanks a lot!

However, I have a question:

When I turn back on my NAS, I'm not automatically logged in on the share. How can I automate this?

Cheers
m.
madom
Novice
Novice
 
Posts: 44
Joined: Thu Nov 15, 2007 6:57 pm

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby Franklin » Tue Jul 01, 2008 9:55 pm

@madom

Please look here

@all
I believe our engineering team are working on the Browsing of the Synology system in Apple Finder in a release for Fall Quarter, please wait while I get more information.


***Edit***
Yes, this should be available during Fall quarter-
Note: Information is subject to change without notice.
**Franklin is not available**
**Please do not Private Message me for support questions; leave it on the forum so all members can learn. Thanks!**
Library ~ SynologyWiki ~ Synology FAQ ~ Compatibility Lists
Forum Links ~ Forum Policy ~ 3rd-party forums ~ Help us help you ~ Posting Images
Demo Links ~ DSM GUI ~ Photo Station
Downloads ~ Firmware Downloads ~ Beta Program
Support ~ Support Form ~ Submit Kernel ~ Synology eNews
User avatar
Franklin
Synology Inc
Synology Inc
 
Posts: 6772
Joined: Sat Oct 14, 2006 11:33 pm
Location: Washington, USA

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby eccentrix » Wed Jul 30, 2008 6:58 pm

Brilliant! Outstanding!

This should be out-of-the-box in the firmware. As a newbie I had been wondering about this and finally it works!

One small point though. Initially, when I tried this, I could see my 207+ in the Finder but when I clicked on it, it would say "Connect Failed". Suddenly, I realized that there is a "connect as" option and I just specified the correct user instead of the default mac user that it was using. And it worked. All this might sound very newbish.... but I am posting this for the benefit all others who are new to Synology and Mac :)

Cheers! Thanks again for the awesome tip.
eccentrix
I'm New!
I'm New!
 
Posts: 6
Joined: Wed May 07, 2008 7:32 am

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby bandito66 » Wed Sep 10, 2008 3:58 pm

It seems that this trick doesn't work anymore with 717 firmware...
bandito66
I'm New!
I'm New!
 
Posts: 1
Joined: Wed Sep 10, 2008 3:54 pm

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby NetBoot » Wed Sep 10, 2008 6:48 pm

bandito66 wrote:It seems that this trick doesn't work anymore with 717 firmware...


It should work without the mod.

Synology change the startup script for mDNSResponder.

But I can't get it my Mac to connect to the syno by Samba using mDNSResponder!

Here's my mod for S99mDNS.sh

Code: Select all
#!/bin/sh
# Copyright (c) 2000-2008 Synology Inc. All rights reserved.

mDNSFile="/tmp/mDNSResponder.conf"
mDNSPIDFile="/var/run/mDNSResponder.pid"
iTunesFile="/etc/mt-daapd.conf"
action=$1

StopmDNS() {
   if [ -f $mDNSPIDFile ]; then
      kill -3 `cat $mDNSPIDFile`
      rm -f $mDNSPIDFile
   fi
   rm -f $mDNSFile
}

StartmDNS() {
   /usr/syno/sbin/mDNSResponder -f $mDNSFile
}

gItunesServName=""
gITunesEncName=""
gITunesPassword=""

LoadServerID() {
   findIP=0
   IPaddr=''
   maxLanCount=`/bin/get_key_value /etc.defaults/synoinfo.conf maxlanport`
   if [ "$maxLanCount" = "" ]; then
      maxLanCount=1
   fi

   i=0
   while [ $i -le $maxLanCount ]; do
      ifconfig eth$i | grep inet
      if [ $? -eq 0 ];then #find IP
         IPaddr=`ifconfig eth$i | grep inet | cut -d':' -f2 | cut -d' ' -f1`
         findIP=1
         break;
      fi
      i=`expr $i + 1`
   done

   if [ $findIP -eq 1 ];then
           num=0;
       # Transfer IP to number, e.g. 192.168.1.110 --> 2168001110
       num1=`echo $IPaddr | cut -d'.' -f1`
       num1=$((num1%10))
       num2=`echo $IPaddr | cut -d'.' -f2`
       num3=`echo $IPaddr | cut -d'.' -f3`
       num4=`echo $IPaddr | cut -d'.' -f4`
      
       num=$((num2 * 1000000 + num3 * 1000 + num4))
       gITunesEncName=`printf "%d%d" $num1 $num`
      
   else
       gITunesEncName=`date +%s`
   fi
}

LoadItunesConfig() {
   # from /etc/mt-daapd.conf
   KEY_SERVNAME="servername"
   KEY_PASSWD="password"

   gITunesPassword=""
   while read -r line; do
      key=`echo $line |cut -d" " -f1`
      value=`echo $line |cut -d" " -f2`
      if [ "$key" = "$KEY_PASSWD" -a ${#line} -ne ${#KEY_PASSWD} ];then
         gITunesPassword=$value
      elif [ "$key" = "$KEY_SERVNAME" ];then
         gItunesServName=$value
                        LoadServerID $value
      fi
   done < $iTunesFile
}

AddItunes(){
   LoadItunesConfig
   
   Port=3689 # from mt-daapd-0.2.4/src/configfile.c

   #from mt-daapd-0.2.4/src/main.c
   TextRecord="${TextRecord} \"txtvers=1\""
   TextRecord="${TextRecord} \"Database ID=$gITunesEncName\""
   TextRecord="${TextRecord} \"Machine ID=$gITunesEncName\""
   TextRecord="${TextRecord} \"Machine Name=$gItunesServName\""
   TextRecord="${TextRecord} \"mtd-version=0.2.4.1\""
   TextRecord="${TextRecord} \"iTSh Version=131073\""
   TextRecord="${TextRecord} \"Version=196610\""
   
   PasswdToken="Password=false"
   if [ "" != "$gITunesPassword" ]; then
       PasswdToken="Password=true"       
   fi
   TextRecord="${TextRecord} \"$PasswdToken\""
   echo "$gItunesServName   _daap._tcp   local.   $Port   $TextRecord" >> $mDNSFile
}

AddSMB(){
   Port=139
   echo "$1   _smb._tcp   local.   $Port" >> $mDNSFile
}

AddAFP(){
   Port=548
   echo "$1   _afpovertcp._tcp.   local.   $Port" >> $mDNSFile
}
AddHTTP(){
   Port=5000
   echo "$1   _http._tcp.   local.   $Port" >> $mDNSFile
}

###################### Main procedure #####################
case $action in
   start)
   ;;
   restart)
   ;;
   stop)
      StopmDNS
      exit
   ;;
   *)
      echo "Usage: $0 start|stop|restart"
      exit
   ;;
esac

StopmDNS
sleep 1

isServiceStart=0
ServName=`/bin/get_key_value /etc/sysconfig/network HOSTNAME`

isiTunesSupport=`/bin/get_key_value /etc.defaults/synoinfo.conf supportitunes`
if [ "yes" = "$isiTunesSupport" ]; then
   isiTunesEnable=`/bin/get_key_value /etc/synoinfo.conf runitunes`
   if [ "yes" = "$isiTunesEnable" ]; then
      AddItunes
      isServiceStart=1;
   fi
fi

isSMBEnable=`/bin/get_key_value /etc/synoinfo.conf runsamba`
if [ "yes" = "$isSMBEnable" ]; then
   AddSMB $ServName
fi
isAFPEnable=`/bin/get_key_value /etc/synoinfo.conf runafp`
if [ "yes" = "$isAFPEnable" ]; then
   AddAFP $ServName
   isServiceStart=1
fi
if [ $isServiceStart -eq 1 ]; then
   AddHTTP $ServName
   StartmDNS
fi


I can get it to update the /tmp/mDNSResponder.conf file, but just won't connect by way of Samba... Just keeps grabbing AFP.

My guess is that something changed or is new with afpd binary

Anyone have any ideas?

Net....
Product Model: DS-106
Firmware Version: 2.0.3 - 0640

I have my reasons for my insanity....
User avatar
NetBoot
Honorary Moderator
Honorary Moderator
 
Posts: 729
Joined: Tue Oct 24, 2006 8:20 pm
Location: Northeastern U.S.

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby izani » Wed Sep 24, 2008 6:39 am

The script not working on latest version 2.0-0722 on my 106e. Previous version works.
-- IR --
izani
Novice
Novice
 
Posts: 55
Joined: Fri Nov 17, 2006 7:59 am

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby Rogge » Mon Oct 20, 2008 10:41 pm

I have the same problem. The bonjour trick doesn't work anymore after upgrading to 722.
The server is not sharing its drives with Finder anymore.

Update the file /usr/syno/etc/rc.d/S99mDNS.sh:
Code: Select all
mDNSFile="/etc/howl/mDNSResponder.conf"
mDNSPIDFile="/var/run/mDNSResponder.pid"
iTunesFile="/etc/mt-daapd.conf"


The services now working on my mDNS-config:
NAS> ps -aux|grep DNS
7365 root 1056 S /usr/syno/sbin/mDNSResponder -f /etc/howl/mDNSRespond
7366 root 1056 S /usr/syno/sbin/mDNSResponder -f /etc/howl/mDNSRespond
7367 root 1056 S /usr/syno/sbin/mDNSResponder -f /etc/howl/mDNSRespond


but after the first restart of ITunes. The mDNSRsponder.conf is back to default.

I want to change the default, please. This is not fun anymore.
Rogge
I'm New!
I'm New!
 
Posts: 4
Joined: Tue Mar 11, 2008 1:13 pm

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby Rogge » Mon Oct 20, 2008 11:01 pm

changed the S99mDNS.sh with this:
Code: Select all
if [ $isServiceStart -eq 1 ]; then                                             
        AddHTTP $ServName                                                       
        echo "NAS        _smb._tcp.     local.  139" >> $mDNSFile               
        StartmDNS                                                               
fi                                           


as you can see i added this line:
Code: Select all
echo "NAS        _smb._tcp.     local.  139" >> $mDNSFile


I'm a bit leazy with coding but its working now....

Perhaps someone can rewrite the S99mDNS.sh with the option to start smb with bonjour...... :D
Rogge
I'm New!
I'm New!
 
Posts: 4
Joined: Tue Mar 11, 2008 1:13 pm

Re: HOWTO: Getting NAS listed in Shared servers in Finder

Postby Jonny » Sat Nov 08, 2008 11:33 am

I don't see why all this is needed.
I enable Apple talk in disk manager and it shows up just fine in the finder.

Os 10.5.5
Jonny
Trainee
Trainee
 
Posts: 17
Joined: Sat Sep 20, 2008 11:52 am

Next

Return to MacOSX

Who is online

Users browsing this forum: No registered users and 1 guest