Solved How to mount synology drive from FreeBSD?

r2com

Member

Reaction score: 5
Messages: 82

I assume maybe those who use synology can kick in and help, if there are such people here.
here is what I do:

echo 'nfs_client_enable="YES"' >> /etc/rc.conf
service nfsclient start
mount -v 192.168.77.183:/volume1/download /mnt/download

and it gives me error: permission denied.

in the synology control panel I did enable the NFS sharing, nfs permissions set to R/W, No mapping. the host has IP of the FreeBSD machine.

I am stuck and out of ideas...searching for similar threads for linux does not bring any results either... can someone give any hint?
 

aragats

Daemon

Reaction score: 701
Messages: 1,618

Here is the relevant part of my /etc/rc.conf:
Code:
rpcbind_enable="YES"
portmap_enable="YES"
nfs_server_enable="YES"
nfs_server_flags="-t -u -n 8"
nfsv4_server_enable="YES"
nfsuserd_enable="YES"
mountd_enable="YES"
mountd_flags="-r"
Works here for several years.
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

i modified the /etc/rc.conf as aragats has it, same thing, this is output I get:
mount_nfs: nmount: /mnt/download: Permission denied

and yes of course I did create /mnt/download before that
 

Phishfry

Beastie's Twin

Reaction score: 2,667
Messages: 5,587

Here is mine.
NFS Server:
Code:
### NFS Server ###
rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_flags="-rn"
mountd_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"

/etc/export
Code:
/files -maproot=root -network 192.168.0.0/16

Client:
Code:
#### NFS Client ####
nfs_client_enable="YES"
nfs_client_flags="-n 4"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

what is /etc/export? is it a file which I must create with line below:
/files -maproot=root -network 192.168.0.0/16 ?

also what is that "/16" after IP?
 

Phishfry

Beastie's Twin

Reaction score: 2,667
Messages: 5,587

It is subnet mask that allows all connections from 192.168.x.x.
Normally you only need -network 192.168.1.0/24
You absolutely need an /etc/exports file. Don't just borrow mine it is for example.
Learn what it does. Mine is very unsecure.

First off mount -v don't cut it. You need a filesystem 'type' with -t nfs.
Better yet use mount_nfs

My fileserver is at 192.168.1.40
showmount -e 192.168.1.40
Code:
Exports list on 192.168.1.40:
/files                             192.168.0.0

mount -t nfs 192.168.1.40:/files /mnt
OR:
mount_nfs 192.168.1.40:/files /mnt
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

so I still didn't get between /16 and /24
could you give me a hint with full command using mount_nfs?

and a full line I need to have in /etc/exports? (its exports not export, correct?)
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

btw this:
showmount -e 192.168.1.40

actually shows me proper mount and my IP of current freebsd machine! its just...cant get over permission problem
 

Phishfry

Beastie's Twin

Reaction score: 2,667
Messages: 5,587

The slash /16 or /24 is the subnet mask. Use /24 if unsure.

I am using 192.168.1.40 as my example. Please use your NFS server IP address instead.
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

Phishfry, can you tell me what special settings have you applied to synology folder on synology control panel?
again.. because in my case, showmount -e does show proper mount target location (on synology) as well as my current IP on right side... its just I am not sure what is wrong with permission
 

Phishfry

Beastie's Twin

Reaction score: 2,667
Messages: 5,587

Typo indeed. /etc/exports is needed on FreeBSD NFS server.
I can't help you on Synology. I always build my own fileservers.
/etc/exports is not needed on your NFS client.
Did you use my /etc/rc.conf settings for NFS Client and reboot?
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

Did you use my /etc/rc.conf settings for NFS Client?
yes.

so, if "showmount -e <ip_of_synology_nas> returns me subfolder directory for that NAS and with the IP of current machine which I entered there (I entered in synology settings the IP of the machine from which I wanna access it) then it means that the link is working...now I guess its some screwing around with permissions on synology thing required... so.. I'd appreciate if any synology user can give additional hint
 

Phishfry

Beastie's Twin

Reaction score: 2,667
Messages: 5,587

You might need to consider what OS the synology is using (Linux?) and adjust your settings until working.
The FreeBSD RPC settings may be unneeded.
 

Phishfry

Beastie's Twin

Reaction score: 2,667
Messages: 5,587

The Synology could also be using NFSv4 which uses different syntax. So check what NFS version it is using.
 

aragats

Daemon

Reaction score: 701
Messages: 1,618

scr-0522-223439.png
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

aragats,Phishfry

ok, I do have same page there where the tick mark is on "Enable NFSV4 support" (just v4 not v4.1) as you have.

but what syntax I must change then? syntax in mounting command?
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

mount_nfs -o nfsv4 <ip>:/volume1/DOWNLOAD /mnt/download
again yields:
mount_nfs: nmount: /mnt/download: Permission denied
 

aragats

Daemon

Reaction score: 701
Messages: 1,618

I have in /etc/fstab:
Code:
synology:/volume2/common /mnt/nfs   nfs   nolockd,rw  0   0
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

nfs just didn't work for me.
anyway, I managed to mount it via SMB the following way:

add this to "/etc/fstab":
//myusername@servername/download /mnt/download smbfs rw,-N,-I<IP> 0 0

then make sure these lines uncommented in /etc/nsmb.conf
[SERVERNAME]addr=<IP>

[SERVERNAME:USERNAME]
password=<password>

so now every reboot I see folder mounted and I can view files...

however, I can only write to that /mnt/download folder as root, but not as user... what am I missing and how to solve it? I already did:
chown -R regularuser /mnt/download

that doesnt solve it
 

aragats

Daemon

Reaction score: 701
Messages: 1,618

You don't need -N and -I options in /etc/fstab since you already have your settings in /etc/nsmb.conf.
Instead, pass your local user's name or UID with -u option:
Code:
//myusername@servername/download /mnt/download smbfs rw,-u=mylocaluser 0 0
 
OP
R

r2com

Member

Reaction score: 5
Messages: 82

indeed it worked. removed -N-I settings and added -u=mylocaluser,

now after reboot it mounts, and I can R/W with regular user as well.

so..seems like NFS is kinda picky or cumbersome to setup, at least in my case... with SMB it was rather simple because instead of showing IP of client in host side and rely on UID match etc.. all had to do is create username on SYnology, and with that username/pass login from FreeBSD machine.

anyway, solved
 

aw256

Member

Reaction score: 12
Messages: 23

I believe this only works if the Shared Folder in Synology is not encrypted. If it is encrypted, the "NFS Permissions" tab will be greyed out in DSM. This is the problem I'm facing. SSHFS or SMB is probably going to be my solution, if I can get one of them working properly.
 
Top