• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Folder sharing from Linux to Windows

We have just installed a Linux file-server to replace a WinNT server. In Windows NT we had a directory structure with folders for home users and public folders for some important files. Every user has the only right to read/write his/her home folder and read the public folders. And the adminstrator has the right to access ALL folders in the system. But also you have the ability to give access to other users to a file or folder.

For example: User1, User2, User3, Administrator
-User1 has a folder called Folder1
-User2 has a folder called Folder2
-User3 has a folder called Folder3
-The system has 1 public folder called Public
-User1 can access Folder1 and Public
-User2 can access Folder2 and Public
-User3 can access Folder3 ans Public
-User1 cannot access Folder2 nor Folder3
-User2 cannot access Folder1 nor Folder3
-User3 cannot access Folder1 nof Folder2
-The User2 give User1 the privilege to read/write Folder2
-Now, User1 can read/write Folder2
-Administrator give User3 the ability of full access to all folders
-Now, User3 can access ALL folders in the system.
(Let's say that User3 is an Administrator also)

How can I do this in Linux? Because I can do all the directory structure but just the root can access all the folders and I need the ability to grant access to specific users to write in Public folders, the other users to read and to have some users that can access read/write ALL folders. Like in WINNT.

I'm using the lastest version of SAMBA and LINUX 7.0
  • 3
  • 3
1 Solution
I think you can use groups. (not sure though as I've never done it myself)

Give read and write permission to certain groups and add users to those groups. You might want a different group for each directory.
it's as dorward said: use UNIX groups.
just remove permissions on the folders for group and world, that's it.
With Samba (smb.conf) you can even more restrict access to (samba-)users, see man smb.conf (Keywords: guest ok, public, writable, browsable, create mask, valid users); probably this is enough to archieve what you need, but can only done by admins (of smb.conf)

 > The User2 give User1 the privilege to read/write Folder2
this is not possible with standard groups functionality, a user may just give permissions to a group or world, but not a specific user (except that user is the only member of a group).
If you realy need a permissions per user basis, you need ACLs for your filesystem on Linux too.
wait, AFAIK Samba can be configured such as a user may admin his share with his privileges, without requiering admin permissions.

Never tried it, but if you look at smb.conf, there is a include directive, so if you define your [homes] section like:

  comment = user's private home
  include = /home/%U%/my-smb.conf

and /home/%U%/my-smb.conf is readable/writable by the (samba-)user only, and contains what you like here.

At least on dragon needs to be beated:
  after changing my-smb.conf by the user (or admin), the user must disconnect from Samba, so that due to the next connection the my-smb.conf is read again
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

contiAuthor Commented:
So, there isn't a easy way to do this as in WinNT. The reason that I'm trying to do this is because the group of users save a lot of files in the File server, but sometimes some files have virus and I'm responsible of detecting those virus and removing them. But if (with my windows) I can't access all folders (without using root) then I cannot use an anti-virus program to scan all the files. In WinNT I had an anti-virus installed in the server and it scanned every weekend all the files, but with this I cannot do this (even if I install the anti-virus in other computer). Is this correct?
contiAuthor Commented:
Or, is there a way to give User1 the privileges that root has? at least for the folders?
solution for what you need (which is different to your example in the question) sound easy:

If admin is the user you want to be to start the AntiVirus software, then do following (for example):

   # and so on ..

Then make all your Folders owned by the users (user1, user2, etc.) and group people. Make the folders at least mode 770.
If you need that some users are not allowed to look at some other folders, you need to define several "people" groups ,  but keep in mind that this gets tricky (see my first comment).
You also may configure to allow several users to use sevaral folders in smb.conf shares (see my 1'st comment)
contiAuthor Commented:
Seems to be no easy solution for this. I appreciate your comments.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now