LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2021, 02:55 PM   #1
paulwall96
LQ Newbie
 
Registered: Oct 2021
Posts: 2

Rep: Reputation: Disabled
I changed ownership of root to postgres by accident and when i signed out and try to sudo su - root it wont allow me


when I sudo su - root from my server it gives me this error sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. i cant log into root to change ownership back and i never received a password. is there anything i can do?

ls -l /usr/bin/sudo
---x--x--x. 1 postgres postgres 147328 Jan 26 2021 /usr/bin/sudo

pkexec must be setuid root

Last edited by paulwall96; 10-27-2021 at 06:55 PM.
 
Old 10-27-2021, 03:24 PM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,578

Rep: Reputation: Disabled
Something Ubuntu-based, I presume?
Then How to Boot to Recovery Mode (Safe Mode) in Ubuntu
 
Old 10-27-2021, 08:04 PM   #3
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 2,502

Rep: Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024
Regardless of the distro, you will need to boot to single user mode then repair the changes you made.
The /root directory must be owned by root, the / directory must be owned by root. In fact most of what is in all the system directories except /home should be owned by root.

Can you tell exactly what was changed to ownership by postgres?

For example, if you did something such as "sudo chown -r postgres /" then it likely will require a reinstall. If you only did "sudo chown postgres /root" then maybe recovery is possible.

The error message tells me it was likely something that changed the ownership of files in /usr/bin and possibly many others.

We can get an early estimate of the damage if you post the output of
Code:
ls -l /

Last edited by computersavvy; 10-27-2021 at 08:20 PM.
 
Old 10-28-2021, 01:23 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,493
Blog Entries: 12

Rep: Reputation: 5941Reputation: 5941Reputation: 5941Reputation: 5941Reputation: 5941Reputation: 5941Reputation: 5941Reputation: 5941Reputation: 5941Reputation: 5941Reputation: 5941
Quote:
Originally Posted by paulwall96 View Post
i cant log into root
Obviously sudo won't work anymore, but have you tried logging into root with
Code:
su -
It's possible you don't have a root password though, in which case the previous answers apply.
 
Old 11-04-2021, 02:06 PM   #5
paulwall96
LQ Newbie
 
Registered: Oct 2021
Posts: 2

Original Poster
Rep: Reputation: Disabled
yeah thanks my teacher had to rest my server and I lost everything. but now it will not allow me to sign in to putty. says connection refused
 
Old 11-04-2021, 02:11 PM   #6
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 2,502

Rep: Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024
Quote:
Originally Posted by paulwall96 View Post
yeah thanks my teacher had to rest my server and I lost everything. but now it will not allow me to sign in to putty. says connection refused
That one tells me it is likely that sshd is not running on the new config. Log in locally and start it or have someone start it for you.
 
  


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] sudo to user other than root but do not allow sudo to root Westmoreland Linux - Security 3 02-03-2015 11:48 AM
how to create signed (not self signed) certificate for Apache ? dlugasx Linux - Server 4 12-16-2011 10:08 AM
Trying to upload manually signed packages to PPA that are showing up as not signed. Kenny_Strawn Ubuntu 3 10-14-2010 05:54 PM
Problem with sending a signed int to another signed int. Almost random number given. RHLinuxGUY Programming 8 08-15-2006 11:38 AM
chsh accident; big accident. shinystuffrox *BSD 3 06-06-2005 07:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:35 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