LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   chmod ruined my permissions (https://www.linuxquestions.org/questions/linux-newbie-8/chmod-ruined-my-permissions-716887/)

ebfan1992 04-04-2009 05:16 PM

chmod ruined my permissions
 
ive been using linux for a while and i accidentally made chmod 644 to a bunch of files including some boot files making them inacsessabe by even root. i stopped it before it completly denied me permission to everything but i cant access chmod, recovery mode, or sudo and a lot of others things. they all give me "permission denied" when trying. i dont want to reinstall because i have all of my server files on this computer and i just set it up the way i want it. i can access chown and chgrp and maybe a few other files that you may suggest. im not sure if i can log in as root or maybe login at all. is there anything at all that can help? i am at the edge of pulling my hair out im so frustrated so anything at all would be extremely helpful.

repo 04-04-2009 05:21 PM

You can boot from a live cd and try to put the permissions back.,
However, since you don't know which files are changed, I would suggest to reinstall.
You don't have a backup by any chance ?

ebfan1992 04-04-2009 05:30 PM

i'll download the latest livecd then try it from there. im trying to avoid reinstalling as a last resort, but if this doesnt work i'll probably have to.
thanks!

Tinkster 04-04-2009 05:44 PM

The situation is most likely recoverable - what distro are you
using? Always a good idea to share that valuable piece of
information. Don't re-install just yet!



Cheers,
Tink

MrChilly0 04-04-2009 06:54 PM

Livecd's are the way to go...made this same mistake a while back..just copied my important conf files over to a flash drive and re-installed.

jschiwal 04-04-2009 07:06 PM

If you also changed the permissions of directories as well, then that might be the first thing you want to fix. If the directories can't be entered, that will cause many problems.

TuxSurfer 04-04-2009 08:10 PM

Your title should read "I screwed up my permissions with chmod". chmod does not randomly change permissions on anything, this is user error.

ebfan1992 04-04-2009 09:26 PM

tuxsurfer: my mistake, i don't want to make it sound like it was the chmod's fault.
so i got the livecd working and i can mount the my harddrive. so what should i set all of my commands to? i mean, aren't i supposed to set every folder and file to 775 except for a certain home folder file? so i do chmod 775 /* ? and chmod 644 for that one file? please do correct me if i'm wrong.
thank you, your all lifesavers!

billymayday 04-04-2009 09:32 PM

It would help if you told us which distro you are running, and which files you changed.

Do you recall the command you used, and which directory you were in at the time?

A blanket 755 won't necessarily work as some programs are permission sensitive (ssh comes to mind), and you don't want a lot of root's and configs stuff world readable

TuxSurfer 04-04-2009 09:46 PM

Like Tink & Billy said, it would be helpful to know the distribution you are using, also what LiveCD you are using and if possible what command you used, how you stopped the command and about how far you think it got. You may be able to open the terminal and hit the tab key a couple of times to cycle through recent commands if you don't know exactly (if you are able to log in to your desktop and open the terminal). Any info you can give us will be helpful. I didn't mean to sound like a jerk, but, words have meaning and it is a pet peeve of mine when people blame the machine. My apologies if I offended or came across a little harsh.

~TuxSurfer

ebfan1992 04-04-2009 09:48 PM

oh sorry i'm using ubuntu 8.10. unfortunately i used the command in the root directory (i know i'm stupid) but i thought i was using it in /var/www/. i used 'sudo chmod /* 664'. (see i used a slash) then noticing my mistake, i did ctrl+z but the damage was already done.
edit: oh and i'm using ubuntu 8.10 for the livecd too and i am not able to log in at all (permission denied message) and i seemed to change mostly some boot permissions and most of the files in /bin/ and /usr/ and some in /etc/ and probably a lot more

repo 04-05-2009 03:52 AM

Quote:

i am not able to log in at all (permission denied message) and i seemed to change mostly some boot permissions and most of the files in /bin/ and /usr/ and some in /etc/ and probably a lot more
I really would consider reinstall, just for safety reasons.

jschiwal 04-05-2009 04:05 AM

If you used "sudo chmod /*" and not "sudo chmod -R /*" then only files & directories in the root (/) directory where affected. This is because the command you indicated didn't use the recursion option. If your kernel, initrd & grub files are in grub, this probably only effected directories.

You can fix it then with:
sudo chmod u=rwx,go=rx /*
sudo chmod a=rwxt /tmp

I'm not familiar with Ubuntu's debian based package system, but I believe that it is possible to validate the permissions of the files that a package supplies. You may need to fix enough of the permissions for this to function, but it could be the final step. In your case, if you just changed the permissions of the directories, you should be OK.

canyonbreeze 04-09-2009 11:17 AM

I did a similar screwup the other day by issuing a chown -R root *.*from the root directory. Little by little I'm getting things back but there are still a lot of things that don't work. Is there a database anywhere that lists default owners, groups, permissions, et cetera for various distributions? That would be a really really really usefull tool to have. If not maybe I'll start one.

I'm on a Debian Lenny system, 2GB RAM, nVidia, AMD64. My task right now is to try to get authorizations working. I think screwed up in the /var/run directory, or somewhere.

jschiwal 04-09-2009 06:46 PM

I don't use a debian based system, but there may be an option similar to rpm's "rpm -qV" which would flag permission errors.

Also check your logs just after you made this change. You may have a security program which runs in the background and reports permission changes to important files.


All times are GMT -5. The time now is 07:49 PM.