[ Solved ] home network with access to /home on all computers

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
dannyb
Level 3
Level 3
Posts: 110
Joined: Tue Dec 13, 2022 11:30 am

[ Solved ] home network with access to /home on all computers

Post by dannyb »

Is there any way to configure my home network, ( 3 computers running mint ), so as to access the /home directory, and all sub directories on all 3 machines from all three machines.
As I understand it, samba and warpinator are for sharing a folder or a file. Not what I need. There's a plethora of articles and tutorials on using both. However, I've not been able to find anything that would give me advice on setting up what I need on this network. I have all confidence that it is possible, I just can't find it.
Any pointers?
Last edited by LockBot on Sun Jul 30, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: home network with access to /home on all computers

Post by rene »

If you are asking to in fact share your home-directory AS a home-directory on 3 different machines then the answer is that you should not. Most certainly not when there can be concurrent access from different machines at the same time, but still not when access from just one at a time is "possible" or expected: some files in the home-directory are system-specific and should remain specific to said system.

If you're merely asking to e.g. make available say /home/dannyb from system A on system B and C as say /mnt/A/dannyb -- then sure. NFS is easiest. But please specify.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: home network with access to /home on all computers

Post by rene »

Let me immediately "correct" myself as to NFS being necessarily easiest if you're not the terminal type by the way. Given that you'd normally want access from any machine to any other over SSH anyway, setting that up and reusing it for SFTP connections from the file-manager is "more easiest" I guess.
dannyb
Level 3
Level 3
Posts: 110
Joined: Tue Dec 13, 2022 11:30 am

Re: home network with access to /home on all computers

Post by dannyb »

Sorry, I wasn't being clear.
When mint is installed, it sets up a directory tree. With /home being the top directory. Sub directories descend from there. Desktop, Documents, Downloads, etc. These are the directories I want to share across all three machines. Not just a single "Share" folder where anything I want to share I first have to move to the share folder.
If the file I need has not yet been moved to the "Share" folder, there is no way for me to find it from one of the other machines. If I have to go room to room searching the file system on each machine to find the file I need, I might as well use a thumb drive to move the file.
So I'm looking for a way to select multiple, existing directories and make them shareable across my personal network rather than having a single share folder that requires everything to be first moved there from where it already is.
I found this, https://community.linuxmint.com/tutorial/view/1954. Looks like what I want, but the article is 7 years old and I question if it is still valid.
t42
Level 11
Level 11
Posts: 3734
Joined: Mon Jan 20, 2014 6:48 pm

Re: home network with access to /home on all computers

Post by t42 »

dannyb wrote: Mon Jan 30, 2023 10:07 am I found this, https://community.linuxmint.com/tutorial/view/1954
It's using SMB, which is more appropriate for networking with Windows machines and it is slower than NFS. Both solutions pointed out by rene are more appropriate for Linux.
-=t42=-
RowlandP
Level 4
Level 4
Posts: 238
Joined: Tue Jan 26, 2021 7:30 am

Re: home network with access to /home on all computers

Post by RowlandP »

It sounds like you are describing something like Windows roaming profiles or folder redirection. You can do something like this on Linux, but it involves a lot of work, really requires centralised authentication and is troublesome.

I think you should look into setting up a NAS instead, you can store all your files on that and then access them from any machine.
RowlandP
Level 4
Level 4
Posts: 238
Joined: Tue Jan 26, 2021 7:30 am

Re: home network with access to /home on all computers

Post by RowlandP »

t42 wrote: Mon Jan 30, 2023 10:51 am [
It's using SMB, which is more appropriate for networking with Windows machines and it is slower than NFS.
Where did you get that idea ? SMB3 is as fast as NFS or even faster.
dannyb
Level 3
Level 3
Posts: 110
Joined: Tue Dec 13, 2022 11:30 am

Re: home network with access to /home on all computers

Post by dannyb »

Thanks for the input. Not sure I'm following everything as I'm not yet used to the acronyms used here. I assume "SMB" refers to Samba. The others, NFS, SSH,SFTP, NAS, not a clue so I don't have a way to evaluate them.
There is only one user on this network. Me. And I can only be in one room, on one computer, at a time. There will never be multiple users on this network.
altair4
Level 20
Level 20
Posts: 11454
Joined: Tue Feb 03, 2009 10:27 am

Re: home network with access to /home on all computers

Post by altair4 »

2 options:

[1] Samba [homes] share:

Install samba: sudo apt install samba

Edit /etc/samba/smb.conf and at the bottom of the file add this share definition:

Code: Select all

[homes]
comment = Home Directories
valid users = %S
read only = No
create mask = 0700
directory mask = 0700
browseable = No
veto files = /*.*/
Save the file then restart smbd: sudo service smbd restart

You then have to add your user name to the samba password database. For example in my case:

Code: Select all

sudo smbpasswd -a altair
You would access that home directory from another machine by server name and user name.

So if the machine has a host name of machine1 and your user name on that machine is altair from the other machine you would enter - in your file manager - the following address - and don't forget the .local part:

Code: Select all

smb://machine1.local/altair
Create a bookmark to that location so you don't have to enter it manually again.

[2] SSH

Install ssh:

Code: Select all

sudo apt install ssh
From the other machine you would access this machine with this in the file manager:

Code: Select all

ssh://altair@machine1.local
That will give you access to the whole damn box if you want.

Or you can limit yourself to the home directory:

Code: Select all

ssh://altair@machine1.local/home/altair
You can then create a bookmark to this location.

Side note: You can get fancy with this if you want. You can create an avahi announcement of your ssh server to the rest of your linux boxes by creating an ssh.service file:


Create a file as sudo at /etc/avahi/services/ssh.service with this content:

Code: Select all

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
   <name replace-wildcards="yes">%h SSH</name>
   <service>
       <type>_sftp-ssh._tcp</type>
       <port>22</port>
   </service>
</service-group>
Then on your other Mint machines you can open your file manager and see it under Network like this:
ssh.JPG
ssh.JPG (19.03 KiB) Viewed 1126 times
In this example vxub2204 SSH is my ssh server and VXUB2204 is my Samba server.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
dannyb
Level 3
Level 3
Posts: 110
Joined: Tue Dec 13, 2022 11:30 am

Re: home network with access to /home on all computers

Post by dannyb »

Altair4, couple of questions about your example above.
What do the characters %S for valid user mean? There is only one user on all three machines. Can't just use the name?
What does the line veto files = /*.*/ mean?
Does there HAVE to be a password? if so, what does the -a switch do? Again, only one user for all three machines
dannyb
Level 3
Level 3
Posts: 110
Joined: Tue Dec 13, 2022 11:30 am

Re: home network with access to /home on all computers

Post by dannyb »

Just had a thought. Let me list my variables for everyone and see what we can do. Just going to use 2 machines here. I can add the third when I have this example to go by. Samba is installed on both, wsdd and av something daemon is on both machines. Both machines running mint cinnamon version vera.
Comp1 IP 10.0.131 hostname is main. username is dan. root pw is zaphod. directory to be shared is /home/dan.
Comp2 IP 127.0.0.1 hostname is toshiba. username is dan. root pw is zaphod. directory to be shared is /home/dan.
So, how do I get these two computers to talk to each other? Note, dan is the only person on this network, unless it is required, there is no need for password protection. Currently, both firewalls are disabled until I get this thing running.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: home network with access to /home on all computers

Post by rene »

Since by now others have commented on non-native options I'll just add some quick UNIX-native NFS information.

Let us assume your LAN to be IPv4-network 192.168.123.0/24, i.e., LAN-systems to have IPv4 addresses 192.168.123.x, and let us say you want to export /home/dan/Documents from system 192.168.123.y. On that system you sudo apt-get install nfs-kernel-server and edit its /etc/exports to have a line

Code: Select all

/home/dan/Documents 192.168.123.0/24(rw,async,no_subtree_check)
and run sudo exportfs -av.

Already at this point this share is available to be mounted from 192.168.123.x, potentially modulo system-local firewalls which you should extremely likely not be using on your private LAN in the first place but for which sudo uwf allow nfs on server and/or clients may or may not be useful.

On a client you make sure to install sudo apt-get install nfs-client and mount the server's /home/dan/Documents on the client's same path simply as

Code: Select all

sudo mount 192.168.123.y:/home/dan/Documents ~/Documents
Assuming that UNIX-user "dan" has the same uid and (primary) gid on server and client -- see output of id on those systems -- you're in essence done and would make it permanent in the client's /etc/fstab with

Code: Select all

192.168.123.y:/home/dan/Documents	/home/dan/Documents	nfs	defaults,nofail
If the server isn't up when the client boots the nofail defends against a (forever) hanging boot; of course an inherent issue with network mounts.

The above does also mean that the server should always be 192.168.123.y: it's best to set it/them up in your router's MAC-based reservation table as such

If you have more directories to export you can of course repeat the above but I would myself in that case separate out to be shared directories to e.g. /shared/Documents, /shared/Pictures, etc., on both server and clients, with symlinks back into the home-directories to make them also appear back there again, and then just export and import /shared as per above.

Dependent on your Linux experience the above was either a walk-through or a sketch. I myself advise against Samba: it implements networking protocols from and intended for a fundamentally different operating system and you'd need to f.e. deal with UNIX-type file-ownership/permissions manually. Linux is not Windows and Windows sure as heck isn't Linux (SSH/SFTP is also fine though).
Last edited by rene on Mon Jan 30, 2023 6:15 pm, edited 3 times in total.
altair4
Level 20
Level 20
Posts: 11454
Joined: Tue Feb 03, 2009 10:27 am

Re: home network with access to /home on all computers

Post by altair4 »

dannyb wrote: Mon Jan 30, 2023 4:40 pm Altair4, couple of questions about your example above.
What do the characters %S for valid user mean? There is only one user on all three machines. Can't just use the name?
What does the line veto files = /*.*/ mean?
Does there HAVE to be a password? if so, what does the -a switch do? Again, only one user for all three machines
A [homes] share is a special share that creates a share of every local login user's (%S) home directory on the fly so you don't have to create one explicitly.

The veto files directive hides all the .files and .folders you have in your home directory to prevent the client from inadvertent deleting or modification which could case problems for the server use since these files usually contain all the configuration settings for that user. You can remove the line if you consider yourself lucky.

Yes you have to have a password - at least for a [homes] share. But remember you only need to pass it once since you are given the option to have the system "remember it forever".
dannyb wrote: Mon Jan 30, 2023 5:32 pm Samba is installed on both, wsdd and av something daemon is on both machines. Both machines running mint cinnamon version vera.
Comp1 IP 10.0.131 hostname is main. username is dan. root pw is zaphod. directory to be shared is /home/dan.
Comp2 IP 127.0.0.1 hostname is toshiba. username is dan. root pw is zaphod. directory to be shared is /home/dan.
So, how do I get these two computers to talk to each other? Note, dan is the only person on this network, unless it is required, there is no need for password protection. Currently, both firewalls are disabled until I get this thing running.
If comp2's ip address is 127.0.0.1 you are going to have a problem since it's not in your network - or part of any network. Let's assume for the moment that's a typo

I don't know what you mean by "root pw". You have enabled root itself and gave it a password? Or is that just dan's password?

Your use case is not inconsistent with my recommendations:

For the [homes] share on Comp1 you would access it on the client file manager as:

Code: Select all

smb://main.local/dan
For ssh:

Code: Select all

ssh://dan@main.local/home/dan
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
dannyb
Level 3
Level 3
Posts: 110
Joined: Tue Dec 13, 2022 11:30 am

Re: home network with access to /home on all computers

Post by dannyb »

I really do appreciate the help. Apologies for being a little slow witted here. Please bear with me.

First, rene, thank you for sharing your time and expertise. Unfortunately, I understood about every 4th word. I don't have a clue where to find or manipulate an IPv4 network. I don't have a server and/or client that I know of. Just 2 computers in different rooms As for the router, it's provided by the cable provider. I can turn it on and off and reset it. To my knowledge, I have no way to access the MAC-based reservation table. I don't care if use samba or watusi or something else. I just need to get something working to network these computers so I can get back to my actual work. I chose samba because it was already installed and it's what almost everyone talks about here.

altair4. Thank you also for your time and expertise. So if I understand you correctly, I could use %S or dan so I might as well plug %S in there. Again, there is no other user, just dan. I do like the veto files command, not super needed in this case but I'll use it. And yes, what I called the root pw is just dan's pw.
As for comp2's IP address, here is the output from ifconfig -

enp8s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 54:ab:3a:0d:6e:ec txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 85457 bytes 14520290 (14.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 85457 bytes 14520290 (14.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

nordlynx: flags=81<UP,POINTOPOINT,RUNNING> mtu 1420
inet 100.94.220.34 netmask 255.255.255.255 destination 100.94.220.34
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
RX packets 72533 bytes 56879700 (56.8 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 132698 bytes 19832540 (19.8 MB)
TX errors 1 dropped 3783 overruns 0 carrier 0 collisions 0

wlp7s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.164 netmask 255.255.255.0 broadcast 10.0.0.255
ether 80:a5:89:67:14:cf txqueuelen 1000 (Ethernet)
RX packets 393847 bytes 111139600 (111.1 MB)
RX errors 0 dropped 122 overruns 0 frame 3496953
TX packets 179154 bytes 43967805 (43.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 18
I can ping 127.0.0.1. I cannot ping 10.0.0.164 so I assumed the one I could ping was the one I needed.
To access the share I search for smb://main.local/dan? Didn't know I needed the smb part.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: home network with access to /home on all computers

Post by rene »

dannyb wrote: Mon Jan 30, 2023 7:42 pm I chose samba because it was already installed and it's what almost everyone talks about here.
Yes: you've there described basically all Microsoft technology...

Anyways.
dannyb
Level 3
Level 3
Posts: 110
Joined: Tue Dec 13, 2022 11:30 am

Re: home network with access to /home on all computers

Post by dannyb »

Thanks for all your help and patience guys. I appreciate it. As it turns out, the bios on the newly built machine needed further tweaking. Networking fine now.
Locked

Return to “Networking”