LinuxQuestions.org
Help answer threads with 0 replies.
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 07-06-2013, 05:23 AM   #1
khar
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Rep: Reputation: Disabled
"must be setuid root"


Today not knowing what i am doing i changed owner of all /usr folder recursively from root to user. now nothing works and everytime i want to make sudo command i get "must be setuid root"

i have already checked some old threads about the topic and:
Code:
ls -l /usr/bin/sudo
-rwxrwxrwx 2 jan root size date /usr/bin/sudo
in recovery mode:
Code:
chown root:root usr/bin/sudo
chown: no acces to "usr/bin/sudo": directory or folder does not exist
before i manually in graphic mode changed rights for "sudo" folder i had:
Code:
chown root:root usr/bin/sudo
chown: no acces to "usr/bin/sudo": only read mode
or something like that

//my language is not english, so i am translating errors to english

my question is what should i do beside reinstall. thanks in advance
 
Old 07-06-2013, 05:42 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
Quote:
Originally Posted by khar View Post
(..) what should i do
Depending on your distribution you may be able to restore ownership the easy way (for Red Hat Enterprise Linux, Fedora or related Linux distributions see 'man rpm': setugids and setperms), the harder way (load a Live CD, recursively change ownership of /usr to root, run your distributions package management verification tools if any) or indeed the hard way by reinstalling your OS.


Quote:
Originally Posted by khar View Post
not knowing what i am doing
Teach yourself to think or ask before you mess with things you don't know zilch about and make regular backups.
 
Old 07-06-2013, 05:51 AM   #3
khar
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
i forget to mention...my disribution is Ubuntu 12.04 LTS. can you please give me step-by-step answer?

Quote:
Originally Posted by unSpawn View Post
Teach yourself to think or ask before you mess with things you don't know zilch about and make regular backups.
i only get ubuntu for a month and i did not expect that it would let me mess my system up without any warning...there should be some "stupidity protection" tool, otherwise linux has no chance of mass usage
 
Old 07-06-2013, 07:14 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
Quote:
Originally Posted by khar View Post
can you please give me step-by-step answer?
Run your Ubuntu installation CD in rescue mode, see http://www.cyberciti.biz/faq/howto-b...x-rescue-mode/. Check if that somehow automagically fixes ownership. Else this script may restore ownership (owner and group) by reading the package cache:
Code:
find /var/cache/apt/ -type f -iname \*.deb | while read PKGNAME; do
 dpkg -c "${PKGNAME}" 2>/dev/null | while read -a ARRAY; do
  OG=${ARRAY[1]}; OWNER=${OG//*\/}; GROUP=${OG//\/*}; ENTITY=${ARRAY[5]}; ENTITY=${ENTITY:1}
  [ -e "${$ENTITY}" ] && chown "${OWNER}:${GROUP}" "${$ENTITY}"
done; done
*Note that if you run a Live CD (in rescue mode) your partition will be mounted somewhere, this doc says "/target" so change "/var/cache/apt/" to read "/target/var/cache/apt/".


Quote:
Originally Posted by khar View Post
(..) i did not expect that it would let me mess my system up without any warning...there should be some "stupidity protection" tool, otherwise linux has no chance of mass usage
No! Blame only yourself for your mistakes, not Something Else. And learn from this.
 
Old 07-06-2013, 08:52 AM   #5
khar
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks, i will do it

Quote:
No! Blame only yourself for your mistakes, not Something Else. And learn from this.
I dont think you understood what i was saying. I am not blaming something or somebody else then myself. I was trying to say, that linux is great system for TOP 5% best IT-educated people. If you want to make linux good also for other 95%, you need to make stupidity-protection in the system, because people DO stupid thing in regular basis. And if the consequenve of executing three words command is several hours lost people prefer slower, more expensive, but stupidity-protection containing Windows. This is not blaming, this is an advice!
 
Old 07-06-2013, 10:16 AM   #6
khar
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
update:

with LiveCd i managed to fix the problem with SUDO, but in different way then unSpawn adviced (i did not managed to start RescueMode from LiveCD, it did not gave me the option). Anyway, now i still have most of the problems i had before - i am not able to connect to wi-fi, sounds does not work, some software (e.g. google chrome) do not react when doubleclicking and computer does not shut down. First i thought all these are the consequences of me messing up the SUDO, now i am not sure. recently i did nothing beside updating software with UbuntuSoftwareCentrum and changing owner of all /usr. does anyone has the idea what may be wrong with my system?
 
Old 07-06-2013, 10:16 AM   #7
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
chown root:root usr/bin/sudo
chown: no acces to "usr/bin/sudo": directory or folder does not exist
I don't know if this is relevant but shouldn't there be a leading slash ('/') in front of usr... in your command?
This is from the terminal on my system:
Code:
~$ ls usr/bin/sudo       
ls: cannot access usr/bin/sudo: No such file or directory
~$ ls /usr/bin/sudo
/usr/bin/sudo
You don't indicate from what location you issued that command.
jdk

Last edited by jdkaye; 07-06-2013 at 10:20 AM.
 
Old 07-06-2013, 10:59 AM   #8
khar
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jdkaye View Post
I don't know if this is relevant but shouldn't there be a leading slash ('/') in front of usr... in your command?
yeah, you are right i forgot. anyway, i made the commands eventually right, so problem is not here. now is not problem with /usr/bin/sudo anymore. the problem is now as i described in my last message. internet, software does not work without writeing me any error messages. How do i get to see any system log or some other text information which can be helpful when trying to realize what the problem is?
 
Old 07-06-2013, 11:48 AM   #9
Fred Caro
Member
 
Registered: May 2007
Posts: 999

Rep: Reputation: 166Reputation: 166
khar,
WiFi can be a problem. Ubuntu does come with some "drivers" but it is not a huge list. Find out the chip your wifi device uses and type that into synaptic (synaptic package manager) and see if is listed anywhere. Otherwise just type wireless into synaptic and scroll though wireless packages. You might have to install synaptic manually as I don't it is installed by default, for fear it might compromise 'stupidity protection'.
As for sound, check dmesg for reports of sound configuration problems when booting. Just type dmesg in a terminal and press enter.

Fred.
 
Old 07-06-2013, 12:32 PM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533Reputation: 3533
Quote:
Originally Posted by khar View Post
I dont think you understood what i was saying. (..) This is not blaming, this is an advice!
I understood perfectly what you were saying.
You however, being kind of new to Linux, do not understand where this is coming from.
So, for your edification:
0. Linux is in use in more products and by more people than often realized (and that has got to do very little with education nowadays).
1. Only useless things and those for use by skilled operators come without a manual. (or phrased differently: with Linux you are your own "stupidity-protection").
2. The consequence of executing a three word command is not several hours worth of production lost (if you know what you're doing: if you don't know then don't do it).
3. Linux is not Windows.


Quote:
Originally Posted by khar View Post
(..) i still have most of the problems i had before (..) i did nothing beside updating software with UbuntuSoftwareCentrum and changing owner of all /usr. does anyone has the idea what may be wrong with my system?
If you are unable to find an Ubuntu CD, DVD or bootable USB stick that allows you to enter rescue mode, if you are unable to make it work with any other Live CD, then it may save you time to reinstall your OS. Because until you revert ownership of /usr recursively tackling any other problems makes absolutely no sense at all.
 
Old 07-06-2013, 02:22 PM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
Quote:
Originally Posted by khar View Post
update:

with LiveCd i managed to fix the problem with SUDO, but in different way then unSpawn adviced (i did not managed to start RescueMode from LiveCD, it did not gave me the option). Anyway, now i still have most of the problems i had before - i am not able to connect to wi-fi, sounds does not work, some software (e.g. google chrome) do not react when doubleclicking and computer does not shut down. First i thought all these are the consequences of me messing up the SUDO, now i am not sure. recently i did nothing beside updating software with UbuntuSoftwareCentrum and changing owner of all /usr. does anyone has the idea what may be wrong with my system?
Yes. Having done the same thing many many years ago.

1. Changing the ownership of files also removes any setuid flags set on those files. This removes the security problem of having someone create a setuid file and then giving it to root (a trojan). So things that NEEDED setuid to root (like sudo, su, and a number of other utilities like cron/crontab/some printing...

2. Changing the onwership of files creates huge security problems - UNIX (where I made this booboo) and Linux both use user identification to provide a first level security isolation. Things like named (DNS name servers) are frequently given their own UID - this prevents an attack on the DNS service (if successful) from being able to propagate to other facilities (like user authorization...) and prevents total catastrophe. Some facilities (like mail) must be able to switch between users... and now cannot.

3. Identification of the features and their interrelationships is the responsibility of the administrator. Thus if the administrator makes an error, that error can be (as you found) catastrophic.

4. It is impossible to prevent the administrator from making mistakes, as that also removes the ability of the administrator to administrate. This applies to ALL systems, not just linux/unix. Sometimes you HAVE to be able to change the ownership of files (even thousands of files).

Probably the easiest way to repair the damage is to reinstall. SOMETIMES the package manager has a "force" option that will force it to reinstall packages already installed - and that option can be used to repair the damage. Another relatively easy way is to restore the system from a backup (you did remember to make backups, right?) This does NOT mean you have to restore users files - you should be able to just restore /usr.
 
  


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
Error when logging into chroot jail: "sudo: must be setuid root" Docky Linux - Newbie 4 09-14-2012 03:07 PM
newbie question: whats the difference between "su root", "su" and "su -&quo mojarron Slackware 9 12-07-2009 05:08 PM
Logged in as "root"/Fedora 8 but get "Operation not permitted" when using "chmod etc gosunlee Linux - Newbie 7 02-10-2008 06:56 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM
sudo stopped working: "must be setuid root" quincy_the_penquin Linux - Software 4 04-30-2007 07:37 AM


All times are GMT -5. The time now is 12:53 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration