INSTALL command in linux
Hello All,
I am not sure whether I am posting my question in correct thread or not. Sorry if I am not doing it correct. My problem is, I want set the permissions for existing directory structure in linux. For example, /home/bala/project/ ---- I want to set 755 for /home,/home/bala and /home/bala/project. I was using install command with --mode so that, I can set it if those directories are not already present. But if that directory already present, then also I need to change the permissions. Is it possible using any direct command in linux? Instead of parsing the directories manually and applying chmod? Please share your ideas with me. Thanks. |
Use chmod with recursive switch:
Code:
chmod -R 755 /home Code:
man chmod Code:
man -k keyword |
Quote:
I just want to change only to specific directories... got it? |
Use "find" to track down the directories (-type d). -maxdepth can limit the number of directory levels that are recursively searched. -exec allows for the execution of a chmod on each directory found.
For instance: Code:
find /home -type d -maxdepth 3 -exec chmod 755 {} \; Is that closer to what you want? |
Quote:
Thanks. |
Quote:
Anyway, here's an example script, that takes the full path as only parameter: Code:
pathStr=''; |
Thanks a lot for your reply. It works. But I thought we might have a ready made command to do this.. like install -f ....
Thanks again.:) |
Commands are usually not more than scripts, provided in a standard location like /bin, /usr/bin,... (except for some internal shell commands). So if you put the script in the right place, you have the "command" you're looking for.
|
I knew it well. Thanks.
|
All times are GMT -5. The time now is 05:11 AM. |