Mr. Strockbine wrote:
> is there a way to password protect a directory?
> for instance there is a single ftp account on
> a machine (one user-id/password combo) and its
> shared amoung several users.  Is it possible for
> one user to password protect a directory so the
> other users cannot view the contents?

Yes, this is possible. Create a new group via the 'addgroup' command.
Then password protect the group with 'passwd -g'. Make the directory 
permissions be 770, and make it be in that group. Then users type 
'newgrp' to log in.

[EMAIL PROTECTED]:/tmp>addgroup demo
Adding group demo (102)...
Done.
[EMAIL PROTECTED]:/tmp>passwd -g demo
Changing the password for group demo
New Password: 
Re-enter new password: 
[EMAIL PROTECTED]:/tmp>adduser joey demo
Adding user joey to group demo...
Done.
[EMAIL PROTECTED]:/tmp>mkdir demo
[EMAIL PROTECTED]:/tmp>chmod 770 demo
[EMAIL PROTECTED]:/tmp>chgrp demo demo
[EMAIL PROTECTED]:/tmp>ls -la demo
total 3
drwxrwx---    2 root     demo         1024 Nov  1 17:48 ./
drwxrwxrwt    5 root     root         2048 Nov  1 17:48 ../
[EMAIL PROTECTED]:/tmp>exit
[EMAIL PROTECTED]:/tmp>cd demo
cd: permission denied: demo
[EMAIL PROTECTED]:/tmp>newgrp demo
Password: 
[EMAIL PROTECTED]:/tmp>cd demo
[EMAIL PROTECTED]:/tmp/demo>touch foo
[EMAIL PROTECTED]:/tmp/demo>exit     # log out to leave the group
[EMAIL PROTECTED]:/tmp>cd demo
cd: permission denied: demo

See the gpasswd man page for more information.

-- 
see shy jo

Reply via email to