hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : chown -R in root accident
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

chown -R in root accident

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 11-23-2006, 12:31 AM
TRIBOLIS TRIBOLIS is offline
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

Reply With Quote


Sponsored Links
  #2  
Old 11-23-2006, 02:18 AM
Lightwave Lightwave is offline
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.

Reply With Quote
  #3  
Old 11-23-2006, 02:19 AM
Steven Steven is online now
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.

__________________
Steven Ciaburri | Proactive Linux Server Management - Rack911.com | 1.855.RACK911
System Administration Extraordinaire

Managed Dedicated Servers, Linux Server Management, Disaster Recovery, Server Security Audits

Reply With Quote
Sponsored Links
  #4  
Old 11-23-2006, 02:22 AM
insanelymacintosh insanelymacintosh is offline
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...

__________________
InsanelyMacintosh - Macintosh Software Repository Listings

Reply With Quote
  #5  
Old 11-23-2006, 04:21 AM
TRIBOLIS TRIBOLIS is offline
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.
Reply With Quote
  #6  
Old 11-23-2006, 05:00 AM
rghf rghf is offline
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

Reply With Quote
  #7  
Old 11-23-2006, 05:09 AM
Techark Techark is offline
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.

__________________
Techark Web Hosting
Cloud Servers and Managed Dedicated Servers with Live Proactive Monitoring
My Blog of Random Thoughts

Reply With Quote
  #8  
Old 11-23-2006, 05:13 AM
localhost127 localhost127 is offline
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.

Reply With Quote
  #9  
Old 11-23-2006, 05:15 AM
TRIBOLIS TRIBOLIS is offline
Web Hosting Master
 
Join Date: Aug 2004
Location: AU
Posts: 690
a2b2, yes I have disabled direct root login and it is CentOS.

Reply With Quote
  #10  
Old 11-23-2006, 05:32 AM
TRIBOLIS TRIBOLIS is offline
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).

Reply With Quote
  #11  
Old 11-23-2006, 05:37 AM
rghf rghf is offline
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

Reply With Quote
  #12  
Old 11-23-2006, 05:37 AM
localhost127 localhost127 is offline
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

Code:
ls -l `which su`

Reply With Quote
  #13  
Old 11-23-2006, 05:55 AM
Techark Techark is offline
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.

__________________
Techark Web Hosting
Cloud Servers and Managed Dedicated Servers with Live Proactive Monitoring
My Blog of Random Thoughts

Reply With Quote
  #14  
Old 11-23-2006, 05:59 AM
localhost127 localhost127 is offline
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.

Reply With Quote
  #15  
Old 11-23-2006, 06:04 AM
Techark Techark is offline
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.

__________________
Techark Web Hosting
Cloud Servers and Managed Dedicated Servers with Live Proactive Monitoring
My Blog of Random Thoughts

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
SSHD Rootkit in the Wild Blog 2013-02-22 16:44:08
Mozilla Updates CA Certificate Policy for Software Products Web Hosting News 2013-02-19 12:32:22
CloudLinux Improves Virtualized File System for Shared Web Hosts Web Hosting News 2012-05-30 15:17:05
Mozilla Asks CAs to Revoke All Subordinate SSL Certificates Web Hosting News 2012-02-21 13:29:11
Mozilla Requires CAs to Comply with Security Best Practices by Friday Web Hosting News 2011-09-12 16:04:39


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
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

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?