Permission for particular folder


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Permission for particular folder
# 1  
Old 03-21-2012
Permission for particular folder

Hi All,
I want to change a permission 755 only for a folder <log> under the directory recursively /home . but all other folder permission remain same under /home
Thanks in advance
Chakkaravarthy
# 2  
Old 03-21-2012
My interpretation, without knowing what Operating System we have here or what Shell the O/P uses or anything about the mounted filesystems.

Code:
find /home/ -xdev -type d -name "log" -print | while read dir
do
        ls -lad "${dir}"    # before
        # Remove echo when tested
        echo chmod 755 "${dir}"
        ls -lad "${dir}"    # after
done


Last edited by methyl; 03-21-2012 at 11:11 AM.. Reason: schoolboy error; quotes in case real directory name contains spaces. Extra slash for old O/S
# 3  
Old 03-21-2012
Thanks i will check
# 4  
Old 03-21-2012
This one is one-shot:

Code:
 
#chmod -R 755 <dir_name>

# 5  
Old 03-21-2012
Quote:
#chmod -R 755 <dir_name>
That is madness. I trust that the O/P will ignore this post.
# 6  
Old 03-21-2012
I don't think it does.

Illustration:

I have a directory dir3 and it has some sub directories and files. What I'm trying to do is assign same permissions for that dir3 and its contents (say 777).

--> Before chmod (actual permissions):
Code:
 
# ls -ld dir3
drwxr-xr-x   4 root     root         512 Feb 16 16:34 dir3
# ls -l dir3
total 4
-rw-r--r--   1 root     root           0 Feb 16 16:34 f1
drwxr-xr-x   2 root     root         512 Feb 16 16:34 f2
-rw-r--r--   1 root     root           0 Feb 16 16:34 f3
drwxr-xr-x   2 root     root         512 Feb 16 16:34 f4
-rw-r--r--   1 root     root           0 Feb 16 16:34 f5

--> After my madness:
Code:
# chmod -R 777 dir3
# ls -ld dir3
drwxrwxrwx   4 root     root         512 Feb 16 16:34 dir3
# ls -l dir3
total 4
-rwxrwxrwx   1 root     root           0 Feb 16 16:34 f1
drwxrwxrwx   2 root     root         512 Feb 16 16:34 f2
-rwxrwxrwx   1 root     root           0 Feb 16 16:34 f3
drwxrwxrwx   2 root     root         512 Feb 16 16:34 f4
-rwxrwxrwx   1 root     root           0 Feb 16 16:34 f5

Smilie
# 7  
Old 03-21-2012
@satish51392111 and what has this to do with this thread?

Omg chmod -R 777 . There is never ever a reason to issue this sort of idiot command.

Permissions 777 is a security nightmare. My advice to all reading this thread is don't do it.

If I was your boss, I would remove your admin rights permanently.

Last edited by methyl; 03-21-2012 at 12:54 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reset Permission Of Files and Folder

Hi, Call me stupid but i accidentally executed following command : find $INSTALLDIR/ -type f -exec chmod 644 {} \; now after which I am not able to run any command in system even ls command is giving me error for "permission denied" :( (5 Replies)
Discussion started by: itajooba
5 Replies

2. Red Hat

Use of Execute permission for folder

Hi All, What is the use of execute permission for a folder. I know "for execute a file(script file) we have to provide execute permission to that respective file".But what is the use to give execute permission to folder.Is it equal to read permission ? Regards, Mastan (1 Reply)
Discussion started by: mastansaheb
1 Replies

3. UNIX for Dummies Questions & Answers

Folder permission

Hi, I created user1 & user2 on my Linux machine. User2 cannot access home directory of user1. How user2 access the user1 home directory without changing owner of the directory. from root user, i tried chmod 755 /home/user1. But user2 trying to change directory it provides permission denied... (1 Reply)
Discussion started by: mdnowshath
1 Replies

4. Solaris

Need to transfer files between 2 UNIX servers, with same folder permission

I need to transfer directories/files between 2 Unix servers, with same folder permission. I tried scp, but it retains the the permissions, but changes the owner of the directory/file to the user used to copy them to the destination. I don't want that to happen. If possible without any other... (6 Replies)
Discussion started by: Pandee
6 Replies

5. Shell Programming and Scripting

[Solved] Retrieve all the permission of the /bin folder

hello friends, By mistake I have run find / -type f -exec chmod 644 {} \; now all permission has been chaged of /bin I am not able to change the permission. I am working on the virtuozzo VPS. Is their any way to retrieve the permission to 770 to /bin Note /bin/chmod also not executing... (2 Replies)
Discussion started by: sharlin
2 Replies

6. UNIX for Advanced & Expert Users

permission for all the files in a folder

Hi Guys, Is there a command or some way whenever any file is created in a folder is having a default permission. Cheers!!! (2 Replies)
Discussion started by: mac4rfree
2 Replies

7. HP-UX

Lost Read permission on my folder

Hi I am a normal user on a HP-UX system which is meant for a large group. There are few directories which I think i am owner of. (Name of these directories is same as my username, and I usually have all the permissions in these directories). I was trying to give read and execute... (2 Replies)
Discussion started by: grvs
2 Replies

8. HP-UX

Folder permission

Hi guys, When I switch my user. I cant go to one of the folders. seems that this user has no right to access the folder. can you please help me to give the right to this user in order for him to access to the folder? it gives me permission denied. (2 Replies)
Discussion started by: messi777
2 Replies

9. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

10. UNIX for Dummies Questions & Answers

Folder permission denied

Hi, I tried to create a new folder inside a folder A but was given an error "Permission denied". Any idea? (4 Replies)
Discussion started by: trivektor
4 Replies
Login or Register to Ask a Question