[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: password protect a directory?



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.

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

See the gpasswd man page for more information.

-- 
see shy jo



Reply to: