Is your head still okay, or do you need a doctor?
Sharing files over the network can be done in different ways.
When both computers are constantly on, you could add a line in your fstab mounting a drive in the other computer to this one, and vice versa.
Problem is, when one is switched off, the mount is still there but the connection is gone and the system could/will freeze.
I use autofs. It's a small program which runs as a service in the background. By means of 2 configuration files you setup the connection which will be only be there when you need it, and after a certain time (time-out parameter) the temporary mount is gone. Now when the other computer is witched off, your system will not hang cause there is no mount active.
Install autofs from the repository and dive into the folder /etc. In there you will find a file called auto.master and some others. I would not use the others but make a new one yourself.
In auto.master you write the base folder for all shares, the name of the share file and the setting for the time-out, like this:
Code: Select all
/Data/Shares /etc/auto.shares --timeout=10 --ghost
These are the three last lines in your auto.master file. One thing, make sure there is an empty line after +auto.master line, or it will not work.
/Data/Shares is the base folder I use for all my shares, you can choose everything, but make sure you choose something where you as user have writing permissions, like for example your home directory.
/etc/auto.shares is the second config file I use with details about the share(s)
--time-out-10 means 10 seconds after the connection has been used last the connection is cut-off
--ghost makes sure there will not be any shares still mentioned in your base share folder which no longer are present.
In my /etc/auto.shares folder I have this:
Code: Select all
NAS -fstype=cifs,rw,credentials=/.credentials ://192.168.2.227/public/
NAS = the name of the folder in which the shared drive (partition) will appear. In fact it will be /Data/Shares/NAS in my case
-fstype=cifs means I use the samba (MicroSoft) way of sharing partitions. Another choice would be NFS (Linux) but I find that hard to setup.
rw: I can read and write on the shared drive
credentials=/.credentials: "a form a safety" so not everyone can use the shared drive, partition or folder. Things is, I wrote the username and password in a hidden file .credentials so whenever the computer is running, safety is gone completely. Alternatively you can also forget about this item in the line and type your name and password every time. Safer, but not comfortable.
://192.168.2.227 is the network address of the computer and /folder is the folder which can be shared.
Make sure it can be shared or you won't be seeing it and you will get an error message the folder is not available.
For the other computer it is just the same, only with a different address.
When you don't get contact, switch off the firewall as a test and try it again. Does it work now then you need an open port in your network settings. I hope somebody else can help you with that. Maybe somebody can also explain how to setup NFS in a simple way. I am also interested in that.