Pure Java NFS v3/v4.1 server backed by dCache nfs4j.
This project has been designed as an alternative to winnfsd. Vagrant plugin is available at gfi-centre-ouest/vagrant-nfs4j.
NFS v3 is available, but not untested and unsupported. You should use NFS v4.1 only for now.
Download latest binaries from Github Releases.
Run nfs4j-daemon
. With default options, it will publish the current working directory through NFS.
java -jar nfs4j-daemon.jar
.exe
wrapper.nfs4j-daemon.exe
mkdir /mnt/nfs4j
mount -t nfs 192.168.1.1:/ /mnt/nfs4j
All options are available through Command Line and Configuration File.
java -jar nfs4j-daemon.jar --help
Usage: <main class> [-h] [--api] [--no-share] [--portmap-disabled] [--udp]
[--api-bearer=<apiBearer>] [--api-ip=<apiIp>]
[--api-port=<apiPort>] [-c=<config>] [-e=<exports>]
[-g=<gid>] [-m=<mask>] [-p=<port>] [-t=<permissionType>]
[-u=<uid>] [<shares>...]
[<shares>...] Directories to share
-c, --config=<config> Path to configuration file
-u, --uid=<uid> Default user id to use for exported files
-g, --gid=<gid> Default group id to use for exported files
-m, --mask=<mask> Default mask to use for exported files
-t, --permission-type=<permissionType>
Permission type to use (DISABLED, EMULATED, UNIX)
Default: DISABLED
-p, --port=<port> Port to use
--api Enable HTTP API
--api-port=<apiPort> Port to use for API
--api-ip=<apiIp> Ip to use for API
--api-bearer=<apiBearer>
Bearer to use for API authentication
--no-share Disable default share and configured shares
--udp Use UDP instead of TCP
--portmap-disabled Disable embedded portmap service
-e, --exports=<exports> Path to exports file (nsf4j advanced configuration)
-h, --help Display this help message
Configuration file is loaded from nfs4j.yml in working directory by default.
You can set a custom filepath to this configuration file with -c, --config=<config>
command line option.
port: 2048
udp: false
permissions:
gid: 1000
uid: 1000
mask: 0644
shares:
- 'C:\Users\Toilal\projects\planireza'
- 'C:\Users\Toilal\projects\docker-devbox'
- 'D:\'
Make sure you are using single quote on shares definition strings in yaml configuration file to avoid issues with backslashes.
/
.# Service side
java -jar nfs4j-daemon.jar
# Client side
mount -t nfs 192.168.1.1:/ /mnt/nfs4j
/
.# Service side
java -jar nfs4j-daemon.jar C:\my\folder
# Client side
mount -t nfs 192.168.1.1:/ /mnt/nfs4j
# Server side
java -jar nfs4j-daemon.jar C:\my\folder D:\another\folder
# Client side
mount -t nfs 192.168.1.1:/C/my/folder /mnt/nfs4j-1
mount -t nfs 192.168.1.1:/D/another/folder /mnt/nfs4j-2
:
as separator.# Service side
java -jar nfs4j-daemon.jar C:\my\folder:/folder1 D:\another\folder:/folder2
# Client side
mount -t nfs 192.168.1.1:/folder1 /mnt/nfs4j-1
mount -t nfs 192.168.1.1:/folder2 /mnt/nfs4j-2
shares:
- 'C:\my\folder:/folder1'
- 'D:\another\folder:/folder2'
shares:
- path: 'C:\my\folder'
alias: '/folder1'
- path: 'D:\another\folder'
alias: '/folder2'
By default, permissions type is set to DISABLED on Windows, and UNIX
on Linux.
DISABLED
=> File permission support is disabled. Best performances, but files will always match default uid, gid and mode (chown
/chmod
has no effect).EMULATED
=> File permission support is emulated using a local database. This may impact performance, files uid, gid and mode are preserved on any server OS.UNIX
=> File permission support use native Unix attributes on the server. This better performance than EMULTAED
, files uid, gid and mode are be preserved, but this option is only supported on Unix servers.On default Windows installation, unprivileged user can't create symbolic links, so nfs4j may fail to create symbolic links too.
You have some options to workaround this issue.
nfs4j-daemon
as Administrator.nfs4j-daemon
. (See this StackOverflow post)mvn clean verify