LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 05-27-2002, 07:24 AM   #1
TheSockMonster
LQ Newbie
 
Registered: May 2002
Location: Bury, UK
Distribution: Mandrake
Posts: 7

Rep: Reputation: 0
Password Protected Directories


Is it possible to password protect individual directories without having to define multiple users?
I'm using Mandrake 8.2.

Any help would be much appreciated.

TSM
 
Old 05-31-2002, 12:16 PM   #2
sewer_monkey
Member
 
Registered: May 2002
Location: Toronto, ON, Canada
Distribution: Ubuntu, Debian, RedHat/CentOS
Posts: 622

Rep: Reputation: 31
If you don't understand my explanation at first, please read the manpages of the commands I listed at the bottom.

If you just want to password-protect a directory, then set its group to, say, "private". You will also need to create a password-protected group with the same name first. Also make sure the world permissions on that directory are set to 0 or "o-rwx" (i.e. no permissions). The group permissions should be set to 5/"g+rx-w" (read-only) or 7/"g+rwx" (full access).

Then, to access the protected directory, instruct your users to switch to the "private" group using the "newgrp private" command, which will prompt them for the password of the group "private". Once the user switched to the group "private", he/she will have access to the protected directory. Do not add any users to that group. If a user is listed as a member of a group, he/she can switch to that group without a password.

Here's an example of a procedure (has to be done as root):
Code:
[root@amazon /]# groupadd private
[root@amazon /]# gpasswd private
Changing the password for group private
New Password:
Re-enter new password:
[root@amazon /]# mkdir private_dir
[root@amazon /]# chown -v :private private_dir/
changed ownership of `private_dir' to :private
[root@amazon /]# chmod -v 770 private_dir/
mode of `private_dir' changed to 0770 (rwxrwx---)
The end users will then have to use the newgrp command to log into the group account "private" and access the directory.

To create a new group, see groupadd.
To set the group password, see gpasswd.
To change the permissions on directories and files, see chmod.
To change the ownership of (the user and group that owns) the file/directory, see chown.
To switch groups, see newgrp.
To see what groups you belong to, see id.
 
Old 05-31-2002, 04:07 PM   #3
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
I always wondered if there is a way to do that through samba?
for windoze users, but I guess it isn't
 
  


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
video streaming in .htaccess password protected directories Houseofcyn Linux - Newbie 1 12-20-2004 02:05 PM
Apache2: showing password protected directories hamish Linux - Software 7 11-15-2004 12:50 PM
add image to protected directories login box tommytomato Linux - Newbie 2 05-25-2004 08:37 AM
protected directories tommytomato Linux - Security 2 01-11-2004 10:34 PM
password protected directories dsgdevil Linux - General 1 02-17-2003 12:02 AM


All times are GMT -5. The time now is 04:22 AM.

Main Menu
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