How to write a directory lock shell script?

Hi there,

pleas I want this script urgently. how to lock a directory by shell script?

Using chmod command you can achieve this.

for i in $@
do
        if [ -d $i ]
        then
                `chmod 000 $i`;
        else
                echo "$i not a directory"
        fi
done

You need to give the directories in the argument.

Thank you very mush for you fast replay but i don't want to change the permission or encrypt the folder. i just want to lock by password could you write for me another script please
thanks

Please visit the following URL
Password protecting a directory from displaying

@thillai_selvan: That will only protect the directory from access via HTTP, and only if one is running Apache as the web server.

@joneggk: You'll be out of luck without any 3rd party software and/or encryption, as a regular UNIX can't regulate access to a directory without changing the permissions and/or ACLs, and even then it won't be password protected.

okay so is there any 3rd party software? folder lock application for ubuntu? without encrypting the folder

Let's get your requirements down, OK?

  • Are there multiple persons accessing the Ubuntu machine?
  • Are there multiple persons accessing the Ubuntu machine at the same time?
  • If at the same time, will they be accessing the directory at the same time?
  • What is the technological expertise of the people accessing the directory?
  • Is there a graphical desktop, or is this a server machine?
  • Do you need plausible deniability?

[/COLOR]

of cource! let me explain to you there is 1tb hard drive and 3 users use that hard drive for a back up. and they want to protect there data. we don't want to use server and any other option. the only thing what they want is lock there folder. that is the reason.

Please edit your post.
Again and again you are posting the same informations.

---------- Post updated at 01:43 PM ---------- Previous update was at 01:42 PM ----------

I think it is corrected now. Thanks!!!

Please, answer all (or at least most) of the questions. Because the solution for a parallel backup device protection is very different from a protection for a desktop machine used only by 1 person at a time, and a solution for a technically advanced person is different that something for someone who's already challenged by point-and-click interfaces.

oh sorry i think this is much better

*  Are there multiple persons accessing the Ubuntu machine? 

 no they have own machine

* Are there multiple persons accessing the Ubuntu machine at the same time?

no

* If at the same time, will they be accessing the directory at the same time?

no

* What is the technological expertise of the people accessing the directory?

 users

* Is there a graphical desktop, or is this a server machine?

 Desktop 

* Do you need plausible deniability?  absolutely! 

Thanks

Ok, so you've got a few users, each with his/her own machine, using an external USB drive for backup purposes. Since they all probably are regular users, we'll leave out the cryptoloop option.

I'd go for separate TrueCrypt containers for each of the users. That way they won't be able to access each others data on the drive, they'll have a nice GUI, and since the containers are limited in size you'll even have a rudimentary quota management.

okay i think i give up for encrypting. i don't have any choose

pludi thank you very much for your time

Regards