LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-09-2003, 04:33 AM   #1
Dodge This
LQ Newbie
 
Registered: Aug 2003
Posts: 8

Rep: Reputation: 0
Question broke stuff with CHMOD...ick


i seem to have dug myself a hole using chmod

i [being a semi-newbie] was getting frustrated with having to switch back and forth between the root account and my user account when trying to access the roots files and programs that were installed under root. I had a bunch of mp3s and pics in my root's home, and wanted to access that folder under my user account, so i studied up on how to do this and stumbled across chmod.

after a few minutes i get the command sorted out for chmod and gave myself full rwx access to this folder, and used -R to get every thing nestled. so then i thought to myself, 'wow that was easy' so i started doing this for every folder in my my / folder, figuring i dont care too much about personal security at this point [considering i just got everything together], and ran 'chmod -R a+rwx file' on everything....

needless to say the next time i ran 'su' i got an error something like 'Operation not permitted' [something like that, i cant say exactly because i have to use winxp now just to write this email ] and, worse, my old root password wont work...and im POSITIVE i didnt touch it, and it worked prior to my chmod rampage.

during startup i there is a few new lines warning me about something being world readable...if need be, i can relay the entire section in a folow up post.

im running RedHat 9.0 and kernel 2.4.20-8

im stumped with this one...figured everything else so far on my own until now, but now that my root password is not working, im a lilttle stumped.

any help would be GREATLy appreciated.

thanks!
 
Old 08-09-2003, 04:39 AM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Welcome to LQ

A rarety from me, but I'd say, backup and reinstall. Doing a chmod -R on / is going to take you a month to suss out, and that's a good outlook. I guess first thing first if you wanna try though:
chmod 722 /etc/group /etc/passwd (actually likely most of /etc)
And follow with a:
chown -R root.root /etc

Good Luck, and like I said, it's rare, but with this kind of thing, you are best off just wiping it and learning from the mistake Backup of course.

Cool
 
Old 08-09-2003, 04:44 AM   #3
Dodge This
LQ Newbie
 
Registered: Aug 2003
Posts: 8

Original Poster
Rep: Reputation: 0
-

wow quick response!

sticky thing is, is that chmod seems to not work correctly when not under the root account, or su. and since my user account is all i can use right nowm im not sure how to give chmod permission to change whatever it has to and stop giving me errors

ick! haha
 
Old 08-09-2003, 04:53 AM   #4
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Ah, the answer I hate to give probably more than re-install...

Since you chmodded everything, you should be able to chmod everything back now, but that's no biggie, let's give your user the appearance of root, something you should NEVER EVER EVER EVER EVER..... EVER do:
Fire up a text editor, I prefer vi:
vim /etc/passwd
Arrow down to your user entry (assuming it's chuck, go to the entry with 'chuck')
Change the numbers from something like 501 or 500 to 0 save and exit (assuming this file was 'chmodded' this'll work, if not, maybe a single user mode will be appropriate, we'll see).

Now that user **should** virtually be "root". NEVER EVER EVER VER.....EVER...EVER do this though, normally.

Cool
 
Old 08-09-2003, 04:57 AM   #5
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
the reason su doesnt work is because youve lost all the setuid permissions so at a guess the following and possibly more will not work(as a non-root user). mount, umount, su, ping and a few shadow passwod utilities. im not sure why your old root password doesnt work possibly something to do with the permissions of /etc/shadow but thats just a guess. as MasterC reccomends your only real choice is to backup and reinstall. to get su working chmod 4755 /bin/su, this will only work if root. if you cant get to root, pass a shell as the init option to the kernel - if you dont know what this means, dont worry just reinstall

Quote:
Change the numbers from something like 501 or 500 to 0 save and exit (assuming this file was 'chmodded' this'll work, if not, maybe a single user mode will be appropriate, we'll see).
will this work? he says his root password doesnt work and i thought the lookup in /etc/shadow was based on uid?

Last edited by kev82; 08-09-2003 at 05:05 AM.
 
Old 08-09-2003, 05:00 AM   #6
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
kev, would dropping in the install CD and getting to a term help the situation at all? I mean, the chmod would then be called from the root perms of the disc right? Which, being read-only are going to be correct since it's the install discs

From there he could chmod a bit around, mess with a few things to "pick up the pieces" and start rebuilding his shack he just destroyed? No? Just some thoughts, he might learn quite a bit and become the next permissions wizard!

Cool
 
Old 08-09-2003, 05:16 AM   #7
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
i dont see why not, if he gets to a root console, mounts his filesystem, and sorts out the setuid problems and /etc then the system should be perfectly useable(assuming he uses devfs and not a static /dev) then he can go chmodding away and most certanly would become a permissions wizard.

btw i still cant get that quote thing right, you said put the name in {i}{/i} tags and the body in {b}{/b} tags obviosly replacing { with [ that just does bold and italic, what i want is where it says quote: after the colon i want the persons name to appear.
 
Old 08-09-2003, 05:19 AM   #8
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Yeah, add the quotes bit too:
{QUOTE}{i}Originally posted by Toby{/i}
{b}Body{/b}{/quote}

So:
Quote:
Originally Posted by Stone Cold Steve Austin
Austin 3:16 says I'm gonna...


Cool
 
Old 08-09-2003, 05:21 AM   #9
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Quote:
Originally posted by kev82
will this work? he says his root password doesnt work and i thought the lookup in /etc/shadow was based on uid?
Dunno I tend to not do this, so it's just pulling different parts of knowledge together to see what'll work.

He could certainly delete the entry in /etc/shadow as well, that wouldn't cause any headaches other than no root pass...

Cool

<after thought>
When in 'rescue mode' with the disc, he could uninstall/reinstall the shadow rpm, just guessing, but maybe that'd set him straight on that at the very least?

Cool

Last edited by MasterC; 08-09-2003 at 05:28 AM.
 
Old 08-09-2003, 07:48 AM   #10
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
about the quotes, what u did wasnt what i meant but ive spent 20 minutes looking through all the threads ive posted in and cant find what i want so i must have been dreaming or something.

Quote:
Originally by MasterC
He could certainly delete the entry in /etc/shadow as well, that wouldn't cause any headaches other than no root pass...
ive just tried that and it doesnt work, however if you remove the x in /etc/passwd and just leave the password entry empty eg:

root::0:0:root:/root:/bin/sh

then it lets you login with no password, at which point you can start chmodding 4755

Quote:
Originally by MasterC
When in 'rescue mode' with the disc, he could uninstall/reinstall the shadow rpm, just guessing, but maybe that'd set him straight on that at the very least?
i dont know whats in the rpm but i think the main problem is /etc which i would have thought was constructed on the fly in the install rather than in an rpm but it would certanly set a lot of the setuid bits back.
 
Old 08-09-2003, 08:01 AM   #11
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Were you looking for something like this:
Code:
Originally Posted by Kev 
Yeah, I didn't mean an entire RPM, just one for shadow.  But I see your point.
?

Cool
 
Old 08-09-2003, 08:21 AM   #12
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
nope, more like this

quote: by person
-------------------------------------------------------------------------
quoted text
-------------------------------------------------------------------------

while your here where would one find libglut.a on mandrake 9??
http://www.linuxquestions.org/questi...threadid=80200

Last edited by kev82; 08-09-2003 at 08:24 AM.
 
Old 08-09-2003, 08:26 AM   #13
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
http://www.linuxquestions.org/questi...994#post415994

Originally posted by Thread Hijackers
Quote:
We are surely hijackin this thread, Dodge This, feel free to jump back in at any time with any questions/additions.


Like that?

Cool
 
Old 08-09-2003, 08:30 AM   #14
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
no, the persons name was on the same line as "quote:" im convinced i must have dreamed it up
 
Old 08-10-2003, 05:13 PM   #15
Dodge This
LQ Newbie
 
Registered: Aug 2003
Posts: 8

Original Poster
Rep: Reputation: 0
haha....im jumping back in now!

i took masterC's original advice- i re-installed RH9 from scratch, and built it back up as best as i could.

thanks a ton for the follow up advice, although most of it was way over my head at this point, it was the not-understanding of chmod that got me into this mess in the first place

i do have another related question tho, however. i was wondering if there are any SAFE directories from the / level that i can chmod with -R. im asking this because i get a little frustrated with having to chmod each individual directory as i tinker with things here and there....for example installing gaim plugins or gettin my fstab all set up for xp partitions. whenever i do anything with su the directory or file, by default, gives my user no permissions to change anything, so i was wondering if i could get some of the permission changing out of the way by chmodding with -R some directories that take alot of ins and outs, like /usr for example...

any ideas?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ok, so I broke it.. Sanguines Linux - Software 4 08-25-2005 12:46 PM
What can we do if we type chmod ugo-x /bin/chmod ?????? bunny123 Linux - Software 3 02-01-2005 09:53 PM
When installing new stuff in suse 9.1, do you uninstall old stuff first? randon SUSE / openSUSE 1 12-25-2004 05:37 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 06:37 AM
A quick q: how to view chmod stuff? orange400 Linux - General 2 04-23-2004 06:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration