I heard that NFS share via SSH tunnel is impossible on Mac OS X: http://biowiki.org/MountingNFSThroughSSHTunnel
I have been trying 2 days to make it, but I failed. Is it really impossible? Or what should I have to do?
I heard that NFS share via SSH tunnel is impossible on Mac OS X: http://biowiki.org/MountingNFSThroughSSHTunnel
I have been trying 2 days to make it, but I failed. Is it really impossible? Or what should I have to do?
In Snow Leopard, the mountport
and port
options appear to be supported, but if the manual is lying (not altogether unusual, as Apple often just copies the FreeBSD manuals) then you won't be able to do it. ssh
doesn't know how to tunnel either Sun RPC or UDP; you would have to add both of those to ssh
and the remote sshd
, and Sun RPC in particular will be difficult to say the least.
(strings /sbin/mount_nfs
seems to indicate that those options are in fact supported.)
,port=%d ,mountport=%d
. I'm currently fighting with mount_nfs: bad MNT RPC: RPC: Authentication error; why = Client credential too weak\n
...
I got succeeded! Mostly I followed the tutorial which I linked in the question. However the OS used in the question is CentOS different with FreeBSD.
First just initiate a FreeBSD box with SSH and NFS. I used fresh new installation in VM.
I made a directory to share ttt
.
mkdir /ttt
chmod 777 /ttt
And exported it via NFS by adding this line to /etc/exports
/ttt -alldirs
And add this line to /etc/rc.conf
mountd_flags="-n"
All done. No more server-side setting job required.
The flag -n
enables non-root mount. It feels some security issue but however this is most simple way. I'll post a new question about security of this flag.
And establish 2 SSH tunnels.
ssh -2 -N -L 5000:localhost:2049 [email protected]
ssh -2 -N -L 5001:localhost:1019 [email protected]
test.local
is the address of the FreeBSD box. And the localhost
in the command means the FreeBSD box itself. (This will be evaluated in server-side) You have to open multiple terminal window because I didn't set -f
to keep SSH foreground. Just for checkup.
The port number 2049
is default port for NFS server, and 1019
is default port of mountd
. You have to always specify this port numbers because NFS has no official default port number. (That's just de-facto standard :) I don't know about mountd. 2 days taken getting know the fact that I have to specify these damn port numbers.
And in other terminal, mount via SSH tunnels.
mount_nfs -v -o port=5000,mountport=5001,tcp localhost:/ttt /tttm
I used -v
for log messages. I have /tttm
folder on my Mac. These messages,
mount localhost:/ttt on /tttm
mount flags: 0x0
127.0.0.1 tcp,port=5000,mountport=5001, fh 28 ea58774dc6ccd11b0c000000016a00003300c1da0000000000000000
NFS options: 0x3004200 fg,retrycnt=1,vers=3,sec=sys (1)
printed, and shared volume appeared at the location /tttm
!
My method may have many security issues. Such as chmod 777
or -n
switches look insecure. If you know better configuration, please let me know. Thank you.