Difference between revisions of "Using JFileServer Enterprise From The Command Line"

From FileSys.Org Wiki
Line 29: Line 29:
 
   +- runsrv.sh
 
   +- runsrv.sh
  
== Using JFileServer On Windows ==
+
== Using JFileServer Enterprise On Windows ==
On Windows the default JFileServer configuration runs the SMB server using the native SMB port 445. In order for this not to clash with Windows using the same port a registry edit is needed. The JFileServer kit includes the ''port445.reg'' file to switch off the Windows OS use of port 445. To apply the registry edit double click the ''port445.reg'' file, then restart Windows.
+
On Windows the default JFileServer Enterprise configuration runs the SMB server using the native SMB port 445. In order for this not to clash with Windows using the same port a registry edit is needed. The JFileServer Enterprise kit includes the ''port445.reg'' file to switch off the Windows OS use of port 445. To apply the registry edit double click the ''port445.reg'' file, then restart Windows.
  
Switching off port 445 on Windows may have other side effects on the Windows host, an alternative way to run JFileServer is by using the Docker images, details of how to use the Docker images are [[Using the JFileServer Docker Images|here]].
+
Switching off port 445 on Windows may have other side effects on the Windows host, an alternative way to run JFileServer Enterprise is by using the Docker images, details of how to use the Docker images are [[Using the JFileServer Enterprise Docker Images|here]].
  
Once the registry edit has been applied, use a terminal command line or shell and set the current working directory as the folder where you unpacked the JFileServer kit zip file.
+
Once the registry edit has been applied, use a terminal command line or shell and set the current working directory as the folder where you unpacked the JFileServer Enterprise kit zip file.
  
To start JFileServer on Windows use the ''runsrv.bat'' batch file :-
+
To start JFileServer Enterprise on Windows use the ''runsrv.bat'' batch file :-
  
 
  runsrv
 
  runsrv
  
The default JFileServer configuration will output debug logging to the console, on startup of the server you should see the following :-
+
The default JFileServer Enterprise configuration will output debug logging to the console, on startup of the server you should see the following :-
  
 
  JFileServer starting, enter 'x' to shutdown server, 'r' to restart server ...
 
  JFileServer starting, enter 'x' to shutdown server, 'r' to restart server ...
Line 58: Line 58:
 
  [SMB] Waiting for new connection ...
 
  [SMB] Waiting for new connection ...
  
To stop the running JFileServer enter ''x'' into the console and hit <Return>, the file server should shutdown within a few seconds, but may take up to a minute or so :-
+
To stop the running JFileServer Enterprise enter ''x'' into the console and hit <Return>, the file server should shutdown within a few seconds, but may take up to a minute or so :-
  
 
  x
 
  x
Line 70: Line 70:
 
  NotifyChangeHandler thread exit
 
  NotifyChangeHandler thread exit
  
== Using JFileServer on linux, macOS, Unix ==
+
== Using JFileServer Enterprise on linux, macOS, Unix ==
On linux, macOS and Unix systems the default JFileServer configuration runs the SMB server using native SMB but via the non-privileged port 1445, so that JFileServer can be run using a normal user account. To run JFileServer on port 445 would require running JFileServer using the root user.
+
On linux, macOS and Unix systems the default JFileServer Enterprise configuration runs the SMB server using native SMB but via the non-privileged port 1445, so that JFileServer Enterprise can be run using a normal user account. To run JFileServer Enterprise on port 445 would require running JFileServer Enteprise using the root user.
  
 
In order for SMB clients to be able to connect to the JFileServer SMB server when it is running on a non-privileged port we need to use the firewall to forward network packets from the default port of 445, that the client will connect to, to port 1445 that the JFileServer SMB server is listening on.
 
In order for SMB clients to be able to connect to the JFileServer SMB server when it is running on a non-privileged port we need to use the firewall to forward network packets from the default port of 445, that the client will connect to, to port 1445 that the JFileServer SMB server is listening on.
Line 117: Line 117:
 
  sudo pfctl -e -f /etc/pf.conf -v
 
  sudo pfctl -e -f /etc/pf.conf -v
  
=== Running JFileServer ===
+
=== Running JFileServer Enerprise ===
 
Using a command line terminal or shell set your current working directory as the JFileServer directory.
 
Using a command line terminal or shell set your current working directory as the JFileServer directory.
  
There is a default JFileServer configuration file that will share the ''testShare'' folder, which contains a single text file. For details on configuring JFileServer see [[Configuring JFileServer|here]].
+
JFileServer Enterprise requires a licence file to enable the Enterprise features, there is a time limited trial licence included in the JFileServer Enterprise kit in the''licence/'' folder. If you have purchased your own licence you should copy the licence file into the ''licence/'' folder, the default name for the licence file is ''jfileserver.lic''. The location and name of the licence file can be changed in the XML server configuration file.
  
To start JFileServer use the ''runsrv.sh'' script file :-
+
There is a default JFileServer Enterprise configuration file that will share the ''testShare'' folder, which contains a single text file. For details on configuring JFileServer see [[Configuring JFileServer|here]].
 +
 
 +
To start JFileServer Enteprise use the ''runsrv.sh'' script file :-
  
 
  ./runsrv.sh
 
  ./runsrv.sh
  
The default JFileServer configuration will output debug logging to the console, on startup of the server you should see the following :-
+
The default JFileServer Enterprise configuration will output debug logging to the console, on startup of the server you should see the following :-
  
 
  JFileServer starting, enter 'x' to shutdown server, 'r' to restart server ...
 
  JFileServer starting, enter 'x' to shutdown server, 'r' to restart server ...

Revision as of 10:10, 11 January 2019

To run JFileServer Enterprise from the command line you first need to download the latest JFileServer Enterprise Kit zip file from here.

Unpack the JFileServer Enterprise Kit zip file into a new folder. You should now have a folder with the following files and folders :-

/jfileserver
 |
 +- /testShare
     |
     +- sharedFile.txt
 +- /lib
     |
     +- bcprov-jdk5on-1.48.jar
     +- hazelcast-3.10.1.jar
     +- jfileserver-1.1.1.jar
     +- jna-5.1.0.jar
     +- jna-platform-5.1.0.jar
 +- /licence
     +- README.txt
     +- jfileserver.lic
 +- /licencing
     +- BouncyCastle.txt
     +- Hazelcast.txt
     +- JFileServer.txt
     +- JNA.txt
 +- EULA.txt
 +- fileSrvConfig.xml
 +- port445.reg
 +- runsrv.bat
 +- runsrv.sh

Using JFileServer Enterprise On Windows

On Windows the default JFileServer Enterprise configuration runs the SMB server using the native SMB port 445. In order for this not to clash with Windows using the same port a registry edit is needed. The JFileServer Enterprise kit includes the port445.reg file to switch off the Windows OS use of port 445. To apply the registry edit double click the port445.reg file, then restart Windows.

Switching off port 445 on Windows may have other side effects on the Windows host, an alternative way to run JFileServer Enterprise is by using the Docker images, details of how to use the Docker images are here.

Once the registry edit has been applied, use a terminal command line or shell and set the current working directory as the folder where you unpacked the JFileServer Enterprise kit zip file.

To start JFileServer Enterprise on Windows use the runsrv.bat batch file :-

runsrv

The default JFileServer Enterprise configuration will output debug logging to the console, on startup of the server you should see the following :-

JFileServer starting, enter 'x' to shutdown server, 'r' to restart server ...
Starting server SMB ...
[SMB] SMB Server JFILESRV starting
[SMB] Version 1.0.0, Java VM 25.152-b16, Windows 10
[SMB] Using authenticator org.filesys.server.auth.EnterpriseSMBAuthenticator, mode=USER
[SMB] Server timezone offset = 0hrs
[SMB] Dialects enabled = [Core,CorePlus,DOS LANMAN 1.0,LANMAN1.0,DOS LANMAN 2.1,LM1.2X002,LANMAN2.1,NT LM 0.12]
[SMB] Shares:
[SMB]  [JFILESHARE,DISK,,[./testShare]] [./testShare]
[SMB] Added NTServer flag to host announcement
[SMB] Binding TCP-SMB session handler to address : ALL
[SMB] Binding NetBIOS session handler to address : ALL
[SMB] Request handler SMBRequestHandler_1 waiting for session ...
[SMB] Listening for connections on [SMB,TCP-SMB,ALL:445]
[SMB] Waiting for new connection ...

To stop the running JFileServer Enterprise enter x into the console and hit <Return>, the file server should shutdown within a few seconds, but may take up to a minute or so :-

x
Shutting server SMB ...
[SMB] SMB Server shutting down ...
[SMB] Packet pool at shutdown: [BufferLists: [Bufsize=256,Init=20,Max=100,Avail=20,Alloc=0,Stats=0/0/0] [Bufsize=4096,Init=20,Max=50,Avail=20,Alloc=0,Stats=0/0/0] [Bufsize=16384,Init=5,Max=50,Avail=5,Alloc=0,Stats=0/0/0]  [Bufsize=66000,Init=5,Max=50,Avail=5,Alloc=0,Stats=0/0/0] ]
Shutting server NetBIOS ...
[SMB] Closed session handler [SMB,TCP-SMB,ALL:445]
[SMB] Closed request handler, SMBRequestHandler_1
[SMB] Closed SMB request handler, SMBRequestHandler_1
NotifyChangeHandler thread exit

Using JFileServer Enterprise on linux, macOS, Unix

On linux, macOS and Unix systems the default JFileServer Enterprise configuration runs the SMB server using native SMB but via the non-privileged port 1445, so that JFileServer Enterprise can be run using a normal user account. To run JFileServer Enterprise on port 445 would require running JFileServer Enteprise using the root user.

In order for SMB clients to be able to connect to the JFileServer SMB server when it is running on a non-privileged port we need to use the firewall to forward network packets from the default port of 445, that the client will connect to, to port 1445 that the JFileServer SMB server is listening on.

Setting Up Port Forwarding On Linux

On linux kernel firewall rules are used to forward network packets. The firewall rules are configured using the iptables command.

To enable forwarding of network traffic from port 445 to port 1445 :-

  • Enable network forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
  • Load the iptable_nat module
modprobe iptable_nat
  • Configure the firewall forwarding rule
iptables -F
iptables -t nat -F
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 445 -j REDIRECT --to-ports 1445

Setting Up Port Forwarding On macOS

On more recent versions of macOS (10.10 onwards) the packet filter device is used to control forwarding of network packets. The packet filter is configured using the /etc/pf.conf file and associated files in the /etc/pf.anchors folder.

To enable forwarding of network traffic from port 445 to port 1445. :-

  • Edit the /etc/pf.conf file, add the lines in bold. You will need to run the editor using the sudo command.
#
# com.apple anchor point
#
scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
rdr-anchor "org.filesys"
dummynet-anchor "com.apple/*"
anchor "com.apple/*"

load anchor "com.apple" from "/etc/pf.anchors/com.apple"
load anchor "org.filesys" from "/etc/pf.anchors/org.filesys"
  • Create the org.filesys anchor file in the /etc/pf.anchors folder, add the following line :-
rdr pass on en0 inet proto tcp from any to any port 445 -> 127.0.0.1 port 1445
  • Enable the port 445 forwarding rules using :-
sudo pfctl -e -f /etc/pf.conf -v

Running JFileServer Enerprise

Using a command line terminal or shell set your current working directory as the JFileServer directory.

JFileServer Enterprise requires a licence file to enable the Enterprise features, there is a time limited trial licence included in the JFileServer Enterprise kit in thelicence/ folder. If you have purchased your own licence you should copy the licence file into the licence/ folder, the default name for the licence file is jfileserver.lic. The location and name of the licence file can be changed in the XML server configuration file.

There is a default JFileServer Enterprise configuration file that will share the testShare folder, which contains a single text file. For details on configuring JFileServer see here.

To start JFileServer Enteprise use the runsrv.sh script file :-

./runsrv.sh

The default JFileServer Enterprise configuration will output debug logging to the console, on startup of the server you should see the following :-

JFileServer starting, enter 'x' to shutdown server, 'r' to restart server ...
Starting server SMB ...
[SMB] SMB Server JFILESRV starting
[SMB] Version 1.0.0, Java VM 25.152-b16, OS Mac OS X, version 10.14.2
[SMB] Using authenticator org.filesys.server.auth.EnterpriseSMBAuthenticator, mode=USER
[SMB] Server timezone offset = 0hrs
[SMB] Dialects enabled = [Core,CorePlus,DOS LANMAN 1.0,LANMAN1.0,DOS LANMAN 2.1,LM1.2X002,LANMAN2.1,NT LM 0.12]
[SMB] Shares:
[SMB]  [JFILESHARE,DISK,,[./testShare]] [./testShare]
[SMB] Added NTServer flag to host announcement
[SMB] Binding TCP-SMB session handler to address : ALL
[SMB] Binding NetBIOS session handler to address : ALL
[SMB] Request handler SMBRequestHandler_1 waiting for session ...
[SMB] Listening for connections on [SMB,TCP-SMB,ALL:1445]
[SMB] Waiting for new connection ...

To stop the running JFileServer enter x into the console and hit <Return>, the file server should shutdown within a few seconds, but may take up to a minute or so :-

x
Shutting server SMB ...
[SMB] SMB Server shutting down ...
[SMB] Packet pool at shutdown: [BufferLists: [Bufsize=256,Init=20,Max=100,Avail=20,Alloc=0,Stats=0/0/0] [Bufsize=4096,Init=20,Max=50,Avail=20,Alloc=0,Stats=0/0/0] [Bufsize=16384,Init=5,Max=50,Avail=5,Alloc=0,Stats=0/0/0]  [Bufsize=66000,Init=5,Max=50,Avail=5,Alloc=0,Stats=0/0/0] ]
Shutting server NetBIOS ...
[SMB] Closed session handler [SMB,TCP-SMB,ALL:1445]
[SMB] Closed request handler, SMBRequestHandler_1
[SMB] Closed SMB request handler, SMBRequestHandler_1
NotifyChangeHandler thread exit