LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Support several customers on same linux box (https://www.linuxquestions.org/questions/linux-newbie-8/support-several-customers-on-same-linux-box-885280/)

LinuxGreen 06-08-2011 04:59 PM

Support several customers on same linux box
 
Hi guys, I'm a Linux newbie, trying to make the leap from Micro$oft to Linux.
I'm setting up a new linux box to give email and web services to some small companies I manage.
I'd like to secure things up a bit, as I don't want that user in Company A be able to access Company B data.
For starters I'm planning to create a new place for placing users, groups, files and some other Company related stuff.
I'm thinking about creating a folder structure like this:
/customers/companyX/users
/customers/companyX/users/mail
/customers/companyX/files
and so on...
I want to be able, when I add a user for some company, that the user home dir will be set to
/customers/companyX/users/userX
Question 1: is this folder structure ok, or is there a better,safer place to put it other than / ?
Question 2: how can I set a new user home dir to the path above, when I add it? Similarly, how can I set the email location?
Many thanks!

frieza 06-08-2011 05:26 PM

first of all, i see this is your first post, welcome to lq

i will answer question 2 first
i would look at the man page for useradd
there is an option to set the base path and the home dir of the user as it's being created

you could also create the user and then change the home directory entry in the file /etc/passwd, but i wouldn't recommend this, i would recommend creating the user with the defined home directory rather than changing the home directory after the fact.

as for question 1
no i don't see anything wrong with the home directory structure you proposed, the beauty of linux is that you can do that and you aren't stuck with '/home/user' like windows sticks you with 'documents and settings/user'

Andrew Benton 06-08-2011 05:54 PM

I think you can change the base home directory that will be created for a new user by editing /etc/default/useradd
mine has
Code:

HOME=/home
ie if I add a user derp his home folder will be /home/derp. In your situation I don't think it matters where the folders are, what you need to do is create a group for the users of the different companies and make sure that their home folder are not world readable. Likewise the mail spool. You could make /customers/companyX/files readable only by members of the companyX group and then people of companyY and Z wouldn't be able to read anything in there.

catkin 06-09-2011 12:23 AM

Quote:

Originally Posted by frieza (Post 4380350)
windows sticks you with 'documents and settings/user'

Unless you configure the user's profile (in the registry) differently.

chrism01 06-09-2011 02:27 AM

As frieza said, useradd has the ability to explicitly specify the home dir (specifically -d ); I wouldn't bother messing with the defaults file.
http://linux.die.net/man/8/useradd


All times are GMT -5. The time now is 06:38 PM.