LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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



Reply
 
Search this Thread
Old 01-09-2005, 03:11 PM   #1
Kemik
LQ Newbie
 
Registered: Jan 2005
Posts: 6

Rep: Reputation: 0
User Accounts


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/

And all the subfolders in that Steam folder.

What command would I need?
For mroe info just ask
 
Old 01-09-2005, 04:51 PM   #2
Avatar33
Member
 
Registered: May 2003
Location: South Africa
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
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
 
Old 01-09-2005, 04:57 PM   #3
Kemik
LQ Newbie
 
Registered: Jan 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Hi,
I'm using via ssh.
which directory are the above commands for as it comes u with the message: command not found.
I think im using RH9
 
Old 01-09-2005, 05:01 PM   #4
Avatar33
Member
 
Registered: May 2003
Location: South Africa
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
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.

HTH
Avatar
 
Old 01-09-2005, 05:06 PM   #5
Avatar33
Member
 
Registered: May 2003
Location: South Africa
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
Which distro?

Code:
su
should work as far as I know on most distros. Are you sure you are entering all the command in lower case?

Avatar
 
Old 01-09-2005, 05:46 PM   #6
sharper
Member
 
Registered: Aug 2002
Location: MN USA
Distribution: slakware 9.0
Posts: 121

Rep: Reputation: 15
I want a new User - Bob to only have access to the folder: /home/sharrison/steam/

I don't think you want to do that. Commands such as ls and cp are stored in other directories that you need read access to run.
 
Old 01-10-2005, 03:41 AM   #7
Kemik
LQ Newbie
 
Registered: Jan 2005
Posts: 6

Original Poster
Rep: Reputation: 0
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.
 
Old 01-10-2005, 06:20 AM   #8
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Rep: Reputation: 30
Hi ALL...

I am also having same problem when creating user..

look at my code ....

[root@redhat root]# adduser zameer3 -p icoachmath -u 1010 -g 100 -d /home/zameer3 -s /bin/bash
[root@redhat root]#

i am able to create user but not able to logged in with the user name...
any help would be appreciate.....

thnx in advance..
zameer ahmed syed..
 
Old 01-10-2005, 05:40 PM   #9
Avatar33
Member
 
Registered: May 2003
Location: South Africa
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
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.

I'll get back to you if I find anything.

HTH
Avatar
 
Old 01-10-2005, 06:26 PM   #10
Kemik
LQ Newbie
 
Registered: Jan 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
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
 
Old 01-11-2005, 01:01 PM   #11
Kemik
LQ Newbie
 
Registered: Jan 2005
Posts: 6

Original Poster
Rep: Reputation: 0
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

Any dieas how to fix this?
 
Old 01-12-2005, 05:27 AM   #12
Kemik
LQ Newbie
 
Registered: Jan 2005
Posts: 6

Original Poster
Rep: Reputation: 0
BUMP
 
Old 01-12-2005, 04:22 PM   #13
Avatar33
Member
 
Registered: May 2003
Location: South Africa
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
Hi.Sorry for the delay.

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 ;-)

Avatar
 
Old 01-12-2005, 05:24 PM   #14
Tetova
LQ Newbie
 
Registered: Jan 2005
Distribution: Red Hat 9
Posts: 1

Rep: Reputation: 0
I have same question:

How can I create FTP user (via SSH) that can have only FTP access to only certain directory?
I use Red Hat 9, Apache and ProFTPD.

please...!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
User Accounts Cool_Hand_Luke Linux - Newbie 6 08-24-2005 09:35 PM
user accounts metallica1973 Linux - Security 2 06-19-2005 06:35 PM
User Accounts MrJoshua Linux - General 3 01-10-2003 09:30 AM
User Accounts petey *BSD 4 09-26-2002 10:28 AM
User Accounts afair Linux - Newbie 3 09-19-2002 01:57 PM


All times are GMT -5. The time now is 03:26 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration