METHOD 1:
Hide the folders using the attrib command.
SYNTAX:To Hide: attrib +s +h +r pathandfilename
To View: attrib -s -h -r pathandfilename
s->System File
h->Hidden File
r->Read Only File
EXAMPLE:
Again suppose i want to hide a folder named IMP INFO(located in D drive), then:
attrib +s +h +r "D:\IMP INFO"
And to show the folder type:
attrib -s -h -r "D:\IMP INFO"
METHOD 2:
Lock the folders using the CACLS command, if two or more user account exists. CACLS command displays or modifies access control lists (ACLs) of files.
SYNTAX:
CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
[/P user:perm [...]] [/D user [...]]
filename Displays ACLs.
/T Changes ACLs of specified files in
the current directory and all subdirectories.
/E Edit ACL instead of replacing it.
/C Continue on access denied errors.
/G user:perm Grant specified user access rights.
Perm can be: R Read
W Write
C Change (write)
F Full control
/R user Revoke specified user's access rights (only valid with /E).
/P user:perm Replace specified user's access rights.
Perm can be: N None
R Read
W Write
C Change (write)
F Full control
/D user Deny specified user access.
Wildcards can be used to specify more that one file in a command.
You can specify more than one user in a command.
Abbreviations:
CI - Container Inherit.
The ACE will be inherited by directories.
OI - Object Inherit.
The ACE will be inherited by files.
IO - Inherit Only.
The ACE does not apply to the current file/directory.
EXAMPLE: Open command Prompt. Suppose i want to lock a folder named IMP INFO(located in D drive) and don't want the user account named USER to access the folder then, my command will be:
CACLS "D:\IMP INFO" /E /P USER:N
And if i wish to remove the restrictions, then my command will be:
CACLS "D:\IMP INFO" /E /P USER:F
No comments:
Post a Comment