LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-12-2019, 03:11 AM   #1
Ulysses_
Senior Member
 
Registered: Jul 2009
Posts: 1,303

Rep: Reputation: 57
How to set up identical VM's to access separate folders on a file server VM and be unable to see each other's files


A script generates identical ubuntu VM's. They all have access to a ubuntu file server VM. We want them to only be able to see their own files on the file server and not each other's. How can this be done given the user is the same in all VM's and given the server names of all VM's are the same? Only the DHCP-derived IP's are different.

In other words, how could permissions per IP be implemented? Or ownership per IP? Or per MAC address?

Could limit the number of identical VM's to 10 if need be. The ideal would be to have all files in one folder instead of 10 separate folders. Create 10 different users to become the owners of the files? Also need to counter hackers getting root access to one VM and this is critical: how would they be stopped from accessing files owned by other VM's by spoofing IP's and MAC addresses?

Could generate each VM with a MAC address that will be used to make the username that logs in to the file server, eg user1234567890ab where 12:34:56:78:90:ab is the MAC address, while the file server would have created user user1234567890ab on detection of the MAC address with arp-scan and crucially, the password would be passed to the VM as a text file in a virtual CD, and be a hash on the MAC. But what if the hacker eavesdrops file content while it is transfered? Seems complicated too, any other options?

Last edited by Ulysses_; 05-13-2019 at 08:10 AM.
 
Old 05-13-2019, 12:43 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,704

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
Quote:
access separate folders on a file server VM and be unable to see each other's files
Quote:
The idea would be to have all files in one folder instead of 10 separate folders.
I had read your thread prior to your edit and it would be easier having different usernames but your requirements are still confusing. By what protocol/service are you planning on using to access the files? ssh, nfs, samba etc.
 
Old 05-13-2019, 02:26 PM   #3
Ulysses_
Senior Member
 
Registered: Jul 2009
Posts: 1,303

Original Poster
Rep: Reputation: 57
The ideal, not the idea. As in, that would be nice to have all files in one place but probably not supported by any protocol. The protocol/service is open. As long as a hacked VM cannot mess with files other than its own or eavesdrop any data transfers. sshfs seems to be promising.
 
Old 05-13-2019, 02:50 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,985

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
"We want them to only be able to see their own files on the file server and not each other's."
Generally there are two permissions here. One is the protocol permission and the other is the file based permission. I'd think that something like ACL's could support use but multiple folder seems to be usable and more easy.

Any time a system is hacked it could have means to gain access to others.

Some protocols support multiple access (transactional aware) where some don't.
 
Old 05-13-2019, 03:24 PM   #5
Ulysses_
Senior Member
 
Registered: Jul 2009
Posts: 1,303

Original Poster
Rep: Reputation: 57
Could have 10 users named user1, user2, ..., user10 and respective private/public key pairs in each VM that are generated with ssh-keygen in the host, saved in respective CD images keys1.iso, keys2.iso, ..., keys10.iso with mkisofs, passed to each generated VM through a line like this in the vmx:

sata0:1.fileName = "keys1.iso"

and the public key of each VM would be sent to the file server by running the following just once in each VM:

cp the key files id_rsa and id_rsa.pub from the virtual CD to ~/.ssh/
NUM=`read the number of this VM from the virtual CD`
ssh-copy-id user$NUM@10.0.0.1 # 10.0.0.1 is the file server

and the public key of the file server would be passed to all VM's by running the folllowing in the server every time a new MAC address is detected with arp-scan:

# Let everyone know my public key
for i in {2..11}
do
ssh-copy-id user@10.0.0.$i
done

and finally each VM mounts the network folder at boot time with something like:

NUM=`read the number from the virtual CD`
sshfs user$NUM@10.0.0.1:/home/user/Desktop /home/user/Desktop -C
pkill nemo-desktop
nemo-desktop &

and now the desktop is actually the file server desktop. Minus files belonging to other users? Not sure what sshfs is doing with permissions.

Last edited by Ulysses_; 05-13-2019 at 04:21 PM.
 
Old 05-13-2019, 03:40 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,704

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
My limited knowledge...

nfsv4, samba v3 and obviously sshfs(sftp) are all capable/use encryption.

Permissions or a jailed user would limit accessibility using sshfs/sftp.

With all systems running linux I would not use samba.

For nfsv4 https://help.ubuntu.com/community/NFSv4Howto
 
Old 05-13-2019, 04:36 PM   #7
Ulysses_
Senior Member
 
Registered: Jul 2009
Posts: 1,303

Original Poster
Rep: Reputation: 57
When you mount, how do you tell it that all files must be created with permissions set to -rwx --- ---?
 
Old 05-13-2019, 06:54 PM   #8
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
NFS allows you to export filesystem trees (folder structures) that are accessible to certain NFS clients. As to the requirement to have everything in the same place, you could create directories under /srv that you then export selectively:
Code:
# mkdir /srv/client1
# mkdir /srv/client2
....
# cat /etc/exports
/srv/client1 client1(rw)
...
# exportfs -va
where client1, client2 etc. are the NFS client VMs, either their hostnames or IP addresses. This means that client1 has read/write access to the /srv/client1 share and so on.

For more, see the exports and exportfs man pages.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Have multple win7 pc, and one ubuntu 12.10 pc, they cannot see each other on the net Yobusman Linux - Newbie 6 12-30-2012 02:13 PM
autofs local map files identical but not identical to automount jwaldram Linux - Server 2 10-26-2012 10:35 AM
How can I compare two folders to see if the directories are identical HGeneAnthony Linux - General 2 08-14-2008 05:55 AM
Identical disks that are not identical staphanes Linux - Hardware 8 03-11-2006 11:50 AM
can't see other machines but they can see each other Silly22 Linux - Networking 1 11-20-2002 03:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration