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 all,
I want to create a user account that can only have access to a set directory.
E.g
I want a new User - Bob to only have access to the folder:
/home/sharrison/steam/
This is a good question and welcome :-)
Normally each distro has a nice GUI to do this, so it would help if you post what distro your using.
You probabily have to be a superuser to do this stuff so
1) su
Now assuming our system did not already have a use named Bob, we add the user
2) useradd Bob
This creates a user named Bob, but it also automatically creates a group called Bob. This is important.
Now assuming that the directory /home/sharrison/steam/ already exists. We need to change the owner to Bob.
3) chown bob /home/sharrison/steam/
We can also change the group of the directory to bob
4) chgrp bob /home/sharrison/steam/
This gives us a little flexability, cause later we can add other users to the group bob. So they can perform the same actions as bob. Lets look at the permissions for the folder:
5) ls -l /home/sharrison/steam/
drwxr-xr-x 2 bob bob 4096 Jan 9 23:27 steam/
first symbol tells us were looking at a directory. Next 3 symbols are permissions of owner (bob) and are rwx,next three permisions of group (bob) r-x and other r-x. Since we don't want others to be able to read and execute we need to change this:
6) chmod 770 /home/sharrison/steam/
confirm our changes
7) ls -l /home/sharrison/steam/
rwxrwx--- 2 bob bob 4096 Jan 9 23:27 steam/
Now thats what we want (at least I hope that's what you want). Only bob and the group bob can view, modify, files in that directory.
When another user trys to view files:
ls /home/sharrison/steam
ls: /home/sharrison/steam: Permission denied
This is not the whole story (niether is this part of the story 100% accurate) but it should be enough to get you started! If you need more info, try reading the man pages of the commands above.
Good luck.
Avatar
Darn, I'm tired and I think I've given you the wrong answer.
I've given you the situation where other users are prevented from accessing bobs directory.
You wanted the case where bob is prevented from accessing others directories (right?)
Anyways the same principal applies. Bob will not be in the same group as the other directories, so he gets the "other"s permission. So you need to change the other permision so it does not have read or execute rights.
Hopefully someone will give a better explanation, otherwise I'll clean this up tomorrow.
SU works but things like adduser doesnt.
I offer gameserver hosting and the folder /home/sharrison/steam/sponsored/ is a clients CS folder for his server.
I want to create an account for him so he can have FTP access to upload maps, edit the server configs, etc.
Well I've not setup a FTP server before, but I guess I should so I'll look into it.
Is it not possible to use a user name and password configuration, even if the user does not have a Linux account?
I presume your using VSFTPD (correct?), is there nothing in the documenation that can help you?
You still have not told me which distrobution (Redhat, Mandrake, SuSe, Slackware,...) your using.
Originally posted by Avatar33
I presume your using VSFTPD (correct?), is there nothing in the documenation that can help you?
You still have not told me which distrobution (Redhat, Mandrake, SuSe, Slackware,...) your using.
I'll get back to you if I find anything.
HTH
Avatar [/B]
Yes, Im using the default FTP program.
I think im pretty certain its on redhat
Ok,
New situation.. I was using a gudie tos etup a user permissions for a folder called jim for a new user.
I created the new user and put him in the correct group. I logged using su as root and create a folder for him in home called jim
Now when I want to lgo in with my normal account - sharrison it says:
Could not chdir to home directory /home/sharrison: Permission denied
-bash: /home/sharrison/.bash_profile: Permission denied
-bash-2.05b$ su
Well either you went astray from the guide or the guide is evil.
You must have changed the permissions of your home directory. They are supposed to look like this:
Code:
drwxr-xr-x
Hopefully you know what that means by now.
To see what yours are log in as root, and then change to /home directory and type
Code:
ls -l
You then need to change the permssions to what is shown above. You can use chmod to do this.
Code:
chmod 755 /home/sharrison
Hopefully the owner and group of the directory is still correct, but the ls -l command above will reveal that.
Hope you come right.
Be carefull in superuser mode ;-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.