
11-23-2006, 12:31 AM
|
|
Web Hosting Master
|
|
Join Date: Aug 2004
Location: AU
Posts: 690
|
|
chown -R in root accident
Hi,
I accidently put chown -R username:username * in /root and there is no way to revert? (I forgot to cd directory before chown ownership). I was hoping if there is another way to fix it such as default chown or chown each directories exim, cpanel and whole systems?
I have tried put chown root but /bin/su could not log in as permission denied so I tried to chmod /bin/su in the wheel group but the password failed when tried log in. (I opened another SSH because I didn't want to log out in first SSH).
The server management said I require OS reload but I paid it few days ago and do not want to pay again.
Thanks
|

11-23-2006, 02:18 AM
|
|
Web Hosting Master
|
|
Join Date: Apr 2003
Location: San Jose, CA.
Posts: 1,616
|
|
Have them boot from a livecd, start up SSH so you can login, mount the existing partitions... and fix the directory ownerships that way.
|

11-23-2006, 02:19 AM
|
|
I like ice cream
|
|
Join Date: Mar 2003
Location: California USA
Posts: 11,570
|
|
If you can get a livecd / rescue cd in the server it can be fixed up.
|

11-23-2006, 02:22 AM
|
|
WHT Addict
|
|
Join Date: Mar 2005
Location: Hattiesburg, MS
Posts: 159
|
|
Why not chown the folders back to root?
chown -R root:root /etc/
chown -R root:root /bin/
chown -R root:root /sys/
and the rest...
|

11-23-2006, 04:21 AM
|
|
Web Hosting Master
|
|
Join Date: Aug 2004
Location: AU
Posts: 690
|
|
I have contacted management to get livecd, they said they don't have one on hand. They'll see if the day shift tech can bring one in with him when he gets here.
kingshosting, do you have any more commands from you said and the rest?
I used chown -R root:root * to go back but not sure if they are right. SSH is unable to access as it says:
-bash-3.00$ su
Password:
su: incorrect password (it is correct pass)
-bash-3.00$
Thanks for your help.
Last edited by TRIBOLIS; 11-23-2006 at 04:26 AM.
|

11-23-2006, 05:00 AM
|
|
Web Hosting Master
|
|
Join Date: Jun 2003
Location: UK
Posts: 6,566
|
|
Do you have direct root SSH access and which OS is it?
__________________
Rus Foster - Managing Director
VPS.net - Cloud Hosting At Its Finest - 21 locations and growing!
VPNHQ - Come get yourself a lovely VPN
|

11-23-2006, 05:09 AM
|
|
Web Hosting Master
|
|
Join Date: Apr 2002
Location: Australia or US depends
Posts: 5,723
|
|
Does the username you chowned everything to have ssh access to the box? If so try logging in as that user to ssh and then start chowning things back to root.
Try logging in with the root password and that user name even if they do not have ssh access it may work.
|

11-23-2006, 05:13 AM
|
|
Junior Guru
|
|
Join Date: Sep 2005
Location: Southern California
Posts: 179
|
|
Quote:
|
Originally Posted by Techark
Does the username you chowned everything to have ssh access to the box? If so try logging in as that user to ssh and then start chowning things back to root.
Try logging in with the root password and that user name even if they do not have ssh access it may work.
|
Users cannot chown files to root. He's going to have to either get a root shell and restore the permissions himself, or get someone to boot a livecd (or in single user mode) as suggest above to do it.
Additionally, the reason that su no longer works (for those wondering) is likely because it is a setuid binary. Since it is no longer owned to root, it will just run as the unprivileged user which is useless.
|

11-23-2006, 05:15 AM
|
|
Web Hosting Master
|
|
Join Date: Aug 2004
Location: AU
Posts: 690
|
|
a2b2, yes I have disabled direct root login and it is CentOS.
|

11-23-2006, 05:32 AM
|
|
Web Hosting Master
|
|
Join Date: Aug 2004
Location: AU
Posts: 690
|
|
It is / not /root directory. All system folders have changed ownership as I did try revert root ownership.
Still get this error:
-bash-3.00$ su
Password:
su: incorrect password (it is correct pass)
-bash-3.00$
They are in second SSH program. The first one I am still in.. I won't log out because I don't want to locked out (support could not access except me).
|

11-23-2006, 05:37 AM
|
|
Web Hosting Master
|
|
Join Date: Jun 2003
Location: UK
Posts: 6,566
|
|
A wild shot but does sudo -s work?
__________________
Rus Foster - Managing Director
VPS.net - Cloud Hosting At Its Finest - 21 locations and growing!
VPNHQ - Come get yourself a lovely VPN
|

11-23-2006, 05:37 AM
|
|
Junior Guru
|
|
Join Date: Sep 2005
Location: Southern California
Posts: 179
|
|
Run this and then try again. Make sure you copy and paste it so its not mistyped:
Code:
chown root:wheel `which su`
If it still doesn't work, run the following command and paste the result here
|

11-23-2006, 05:55 AM
|
|
Web Hosting Master
|
|
Join Date: Apr 2002
Location: Australia or US depends
Posts: 5,723
|
|
Quote:
|
Originally Posted by localhost127
Users cannot chown files to root. He's going to have to either get a root shell and restore the permissions himself, or get someone to boot a livecd (or in single user mode) as suggest above to do it.
Additionally, the reason that su no longer works (for those wondering) is likely because it is a setuid binary. Since it is no longer owned to root, it will just run as the unprivileged user which is useless.
|
Depends on what privileges that user had and if he can log in as that user and escalate his privileges.
Your right about that but if he just chowned everything on the box to that username , I do not know if that username is now for all practical reasons now root super user.
It is a long shot at best, if it does not work then he has no choice but to wait for the data center to boot the system using livecd and change the ownerships back to root.
|

11-23-2006, 05:59 AM
|
|
Junior Guru
|
|
Join Date: Sep 2005
Location: Southern California
Posts: 179
|
|
Quote:
|
Originally Posted by Techark
Depends on what privileges that user had and if he can log in as that user and escalate his privileges.
Your right about that but if he just chowned everything on the box to that username , I do not know if that username is now for all practical reasons now root super user.
It is a long shot at best, if it does not work then he has no choice but to wait for the data center to boot the system using livecd and change the ownerships back to root.
|
Unfortunately owning everything to another user does not make that user root (this is really a good thing for TRIBOLIS). The 'su' binary requires it's UID to be 0 (root) in order to actually work. He says that he left the shell open so he does have a root shell. If this is the case then it is just a matter of repairing the correct permissions.
|

11-23-2006, 06:04 AM
|
|
Web Hosting Master
|
|
Join Date: Apr 2002
Location: Australia or US depends
Posts: 5,723
|
|
I did say it was a long shot.
Yes I agree. But he says he has root open but it is not letting him chown things back to root so either he does not have root or root has lost permissions or the username he chowned it to is now root.
I really think he is stuck until livecd or OS reload is done.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|