Folder Lock in Unix

I am a new user of linux. I have 2 Queries
1) I recently started working with shell script, and now i plan to make a folder lock using a shell script. I have ubuntu 8.04 installed on my system.

2) When i searched on this forum all i got was mini-httpd, and apache2-utils package, but they are 4 web directory, i tried them on my college lan(web server: running on red hat), but could not get any result.....

Pls help me, this is really urgent.

:confused:

Folder = directory in unix.

Without resorting to C, the only "lock" generally available is to use a lock file. A file that works as a traffic cop. The only drawback is that every script that accesses the directory under the control of the lock file has to play the game.

Is this some kind of homework?

sort of actually i wish to develop this as a project for my entry into the LUG of my college :rolleyes:, anyways i tried this

  1. Make an .htpasswd file. The htpasswd command in Unix does this. You should put the password file outside of your web directory. So a command like �htpasswd -bc /home/matt/.htpasswd review donotenter� will create a new file using a username of review and a password of donotenter into the file /home/matt/.htpasswd . If you were to run the command �cat /home/matt/.htpasswd� you might see a line like �review:M1OdtjdGiDn1Y�.
  2. Make an .htaccess file. In this case, the file would be located at /home/matt/www/.htaccess and it would look something like
    AuthUserFile /home/matt/.htpasswd
    AuthName EnterPassword
    AuthType Basic
    <Limit GET POST>
    require valid-user
    </Limit>

You might need to fiddle with file permissions a little bit. My .htaccess file was readable by all, and my .htpasswd file was readable by all as well.

didnt workout, though this prompted 4 d passwords and all, but didnot lock the directory as expected.....:confused:

Pls help.................