Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
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'
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.