# File sharing

There are a number of ways to share files with other computers using Fatdog64. They are:

- FTP -- File transfer protocol.
- HTTP --- Web server.
- Samba --- aka SMB, server message block. (This is what Windows uses.)
- SSHFS --- File sharing over SSH

### FTP

FTP is a good choice if you want to move single files, not whole folders. Files must be moved one at a time with FTP, so if you want to do a folder it's best to zip the folder up into one file. To start the FTP server go to Control Panel, click on the System tab, and then Manage Servers and Services. Click on ftpd and then click Start to run the service. Click enable if you want the ftpd server to run at each boot . To connect from another computer you'll need the IP address of the computer running the FTP server. Open a terminal and type ifconfig, it will look something like this:

    # ifconfig
    lo       Link encap:Local Loopback
             inet addr:127.0.0.1  Mask:255.0.0.0
             UP LOOPBACK RUNNING  MTU:16436  Metric:1
             RX packets:0 errors:0 dropped:0 overruns:0 frame:0
             TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
             collisions:0 txqueuelen:0
             RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    wlan0    Link encap:Ethernet  HWaddr 00:23:14:DC:48:B8
             inet addr:192.168.254.42  Bcast:192.168.254.255
             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
             RX packets:48110 errors:0 dropped:0 overruns:0 frame:0
             TX packets:8953 errors:0 dropped:0 overruns:0 carrier:0
             collisions:0 txqueuelen:1000
             RX bytes:17773416 (16.9 MiB)  TX bytes:1027903 (1003.8 KiB)
    #

In this example our IP address is 192.168.254.42. The other piece of information we need is a login name and password. To login as root the default password is woofwoof. When you made your save file, you where given the opportunity to change it. To change the root password, open a terminal and at the # prompt type:

`passwd`

You'll be prompted for a new password. Then from the other computer open Firefox and in the address box type ftp://192.168.254.42. That's for the example above; substitute your IP address. You'll be prompted for a user name and password. You can also connect using gFTP, which is found under Network in the main menu. You can make this available over the internet too. To do that you'll need to login to your router and forward port 21 to the IP address of the computer running the FTP server.

### HTTP web server

Http can be a good choice if you want others to be able to download files, but not upload. To start the web server go to Control Panel, click on the System tab, and then Manage Servers and Services. Click on civetweb and then click Start to run the service. Click enable if you want the http server to run at each boot . The Civetweb web server forks itself to run as user webuser. The server's root is located at /var/lib/www. Files or links placed there will be visible to users of the web server. To connect open a web browser and enter your IP address. The configuration file for the server is located at /etc/civetweb.conf. You can make this available over the internet too. To do that you'll need to log-in to your router and forward port 80 to the IP address of the computer running the HTTP server.

Note: You can also run civetweb as a "user" server and serve any directories you want. Open a terminal, and then type "civetweb". It will then serve the files from the current directory. To stop it, just press Ctrl-C.

### Samba

If you want to share files with other computers on your local network, including Windows computers, this is the way to go. To start the Samba server go to Control Panel, click on the System tab, and then Manage Servers and Services. Click on samba and then click Start to run the service. Click enable if you want the Samba server to run at each boot . This will share your Downloads folder as user spot. To connect from another computer running Fatdog64, open the Shared folder on the desktop and click on Scan. This will create icons for the shared folders found on your network. Then click on those icons to mount the shared folder, right click to unmount. From Windows go to "Network Neighborhood" or "Places". You might have to click refresh a few times for it to show up. Clients connecting to Fatdog64 will only be able to write files in folders that user spot has permission.

### SSHFS

Caution. If ssh is open to external systems then it will be attacked. SSHFS is best used behind a firewall, on a local LAN only.

Preparation
Edit /etc/ssh/sshd_conf to uncomment/set

PermitRootLogin yes
PasswordAuthentication yes

Then from Control Panel --> System tab --> Manage Servers and Services, select/tick the SSHD option and enable it.
If Fatdogs firewall (eztables) is on, then you may prefer to disable it (alternatively reconfigure it to permit ssh connections).

Accessing from Linux :

    mkdir sshfs-dir
    sshfs root@192.168.1.4:/home/example_user sshfs-dir

(change the 192.168.1.4 IP used here to the IP of your file server box)

Accessing from Windows :
SSHFS-Win makes it easy to mount a directory from a remote Linux computer on your local Windows computer.

Install the latest stable installer of WinFSP.

Install the latest stable installer of SSHFS-Win.

Open File Explorer, right-click on This PC and choose Map network drive. Choose a drive to mount at and in the Folder field enter:

    \\sshfs\root@192.168.1.4

(change the 192.168.1.4 IP used here to the IP of your file server box)

By default, Windows will use your Windows password or credentials for the remote computer. Most likely the password and credentials will be different on the remote computer in which case choose the Connect using different credentials option.

Windows will ask for your password at the remote computer (you have changed it from the default password haven't you!). After that the home directory from your remote computer will be mounted at the Windows drive you chose.