Reset Permission Of Files and Folder


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Reset Permission Of Files and Folder
# 1  
Old 05-27-2015
Reset Permission Of Files and Folder

Hi,

Call me stupid but i accidentally executed following command :

Code:
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" Smilie

Last edited by Scrutinizer; 05-27-2015 at 04:26 PM.. Reason: code tags
# 2  
Old 05-27-2015
Hi itajooba,

If you have a backup of the system, now is the time for a restore - failing that.

If you have a current root session that has been in existence from the point at which you ran the command, you may be able to correct this. You will need to pull a copy of the chmod binary from a backup, you could put in in tmp - probably best to use tar to preserve the permissions and then using an other system as a reference start running your new chmod command.

Regards

Gull
# 3  
Old 05-27-2015
Assuming $INSTALLDIR is /bin and you have a open root session, run the same command with 755. After that you can tighten permissions as needed.
# 4  
Old 05-27-2015
He can hardly run find if he can't run anything else. Whether he has a session open already doesn't matter.

Your advice is suspect in any case. There's many very important things in /bin/ which will not work with 755 permissions, such as logins.

Either restore from backup, reinstall from scratch, or craft an executable to set executable bits from raw assembly language and claw your way out from there.

And next time, grant more permissions to your user user instead of trying to chmod an entire filesystem to them.
# 5  
Old 05-27-2015
Depends on the *NIX version. What OS are you running and what is $INSTALLDIR pointing to itajooba?
# 6  
Old 05-27-2015
Quote:
Originally Posted by Corona688
He can hardly run find if he can't run anything else. Whether he has a session open already doesn't matter.

Your advice is suspect in any case. There's many very important things in /bin/ which will not work with 755 permissions, such as logins.
This is all very true but there might be a (slim) chance even in the case "$INSTALLDIR" was in fact /bin: it will depend on which system exactly it is and which binaries are located in /usr/bin and /usr/sbin respectively (supposing /usr/bin is NOT a link to /bin or vice versa, which is customary these days, but not with all systems). There might also be a second set of system binaries, like with SunOS' /usr/xpg4/bin with a usable chmod binary.

There is an additional chance if "$INSTALLDIR" was not "/bin" and the system is AIX: if you have TCB (trusted computing base) switched on you can restore the file permissions of system files quite easily. See the TCB documentation for details.

I hope this helps.

bakunin

Last edited by bakunin; 05-27-2015 at 04:34 PM..
These 2 Users Gave Thanks to bakunin For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. UNIX for Dummies Questions & Answers

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 (8 Replies)
Discussion started by: chakkaravarthy
8 Replies

7. 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

8. UNIX for Dummies Questions & Answers

Permission denied when changing root password after reset

I have a Solaris 10 machine that I didn't know the root password to so I went into single user mode and removed the password from the shadow file and rebooted and I am able to login with no password now. But my problem is that when I try to change the root password from no password to something... (0 Replies)
Discussion started by: darkone_d1_2000
0 Replies

9. OS X (Apple)

Permission Reset?

OSX 10.4.11 I installed an app. I am logged in as Admin. When I launch Limewire I get: You do not have permission to open the application "xxxx". How can I get around this? I tried resetting permission on the terminal and I still get it. (3 Replies)
Discussion started by: coopns
3 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