LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-11-2016, 01:27 PM   #1
gglq000
Member
 
Registered: Mar 2012
Posts: 62

Rep: Reputation: Disabled
changed entire /usr directory to non root owner any way out


i think i did a dump things. i changed the entire directory /usr owner to non root user. no i can not login as root anymore. any way out? Thanks.,
 
Old 08-11-2016, 01:28 PM   #2
gglq000
Member
 
Registered: Mar 2012
Posts: 62

Original Poster
Rep: Reputation: Disabled
this is what happens if i try ownership back to root:

[ggankhuy@localhost /]$ sudo chown -R root /usr/
sudo: effective uid is not 0, is sudo installed setuid root?
 
Old 08-11-2016, 01:44 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Got backups?
 
Old 08-11-2016, 01:45 PM   #4
gglq000
Member
 
Registered: Mar 2012
Posts: 62

Original Poster
Rep: Reputation: Disabled
i dont think so.
 
Old 08-11-2016, 02:07 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
Boot (or switch to single user mode... booting might be problematical depending on the distribution) in single user mode, then force a reinstall of packages.

The problem is that just changing the owner back to root won't necessarily fix things (you can try it though). I think the setuid bit is removed from executables when that happens - thus sudo won't work, neither will passwd or su.

There are usually a LOT of setuid executables for various uses...

The other option is to restore /usr from a backup. Unfortunately, most admins don't do that anymore.

Last edited by jpollard; 08-11-2016 at 02:08 PM.
 
1 members found this post helpful.
Old 08-12-2016, 03:52 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,905

Rep: Reputation: 2615Reputation: 2615Reputation: 2615Reputation: 2615Reputation: 2615Reputation: 2615Reputation: 2615Reputation: 2615Reputation: 2615Reputation: 2615Reputation: 2615
If you can get into single user mode or rescue mode, AND its an rpm based system, then this will help http://www.cyberciti.biz/tips/reset-...ermission.html
 
1 members found this post helpful.
Old 08-12-2016, 03:56 AM   #7
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
The other option is to restore /usr from a backup. Unfortunately, most admins don't do that anymore.
Most admins do not use sledgehammer on their system either ...
 
Old 08-12-2016, 05:46 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
Quote:
Originally Posted by Emerson View Post
Most admins do not use sledgehammer on their system either ...
But a backup is usually much faster than reinstalling from scratch...
 
1 members found this post helpful.
Old 08-12-2016, 06:25 AM   #9
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
Yes it is. Yet, it is up to every admin to decide whether full backups are worth the trouble. One my resort to partial backups, backing up only vital data required to restore the system.
 
Old 08-12-2016, 07:06 AM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
The usual reason to "not backup the system files" is the storage it requires.

Saving everything saves time. No need to step through reinstalling as it can take a couple of hours ... and what you do reinstall may not be the same as what was installed before. It also saves time by not finding out you missed one of the "vital data".. and have to redo finding out what it was.

It is also what happens when you clone a system for backup.

I learned a LONG time ago that an extra backup can save your ass. It allows you to recover a system when things go south - either due to an update that causes damage... (what, you think that never happens?), or updates become incompatible with what what you are doing (a feature you depended on was "discontinued" - as happens with Gnome 3 for example; fortunately, Mate came along as a fork with the previous features).

so yes, make a backup.

Right now I have multiple backups of the system files - one on disk, two as tar files. And soon I will make two more - one to update the on disk backup, and one for the tar files. I even have a backup (soon to be discarded) of the system I previously used (about 5 releases earlier). Since I use Fedora - the on-disk backup are for the current system (Fedora 23), but there is also an on-disk backup of Fedora 16... JUST IN CASE I need that version. The Fedora 14 before that is now considered by me as too outdated... and will be replaced. Likely, I'll use it for a VM in testing.

How much time does an on-disk backup save? Between several hours and several days - depending on the problem. For the OP it would have saved a couple of days.

For me, I would go "oh crap. Well, lets reboot and point to the backup", and be operational in a couple of minutes. And able to replace the original root system in about 30 minutes in the background while running from the backup.

How much time does an offline backup save? I find it can save a couple of hours depending on the media.

I can't use tape anymore (the new drives are too expensive, and the old 2GB dat tapes too expensive and just are not large enough), so that just leaves using disks (cheaper and faster now - for $100 I can make multiple backups easily, and recover them just as easily).

Last edited by jpollard; 08-12-2016 at 07:08 AM.
 
1 members found this post helpful.
Old 08-12-2016, 07:57 AM   #11
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by chrism01 View Post
If you can get into single user mode or rescue mode, AND its an rpm based system, then this will help http://www.cyberciti.biz/tips/reset-...ermission.html
In Slackware, it would be possible to restore permissions using MANIFEST.bz2 data from the installation media

Edit: there is even an util script by Alien Bob that does it automatically
http://www.slackware.com/~alien/tool...om_manifest.sh

Last edited by keefaz; 08-12-2016 at 07:59 AM.
 
  


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
[SOLVED] Invoke root directory owner/group while moving file/directory yogesh_attarde Linux - Security 5 04-14-2014 11:36 PM
HELP!!!! I moved my entire root directory somewhere else!!!! a_cheung Linux - Newbie 11 12-06-2009 06:52 PM
Deleted Entire usr/src/linux Directory JakeyHards Linux - Newbie 3 08-13-2009 09:05 AM
Owner of a directory different than file owner problems Guardian-Mage Linux - Server 4 04-24-2009 10:26 AM
Best security: unprivileged user or root as owner of backup directory? danhs Linux - Security 4 08-18-2008 12:50 PM

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

All times are GMT -5. The time now is 08:32 AM.

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