Results 1 to 10 of 10

Thread: Sudo problem

  1. #1
    Join Date
    Mar 2014
    Beans
    17

    Sudo problem

    I was trying to build Atom and I failed but then I also screwed things up trying to build it.
    Whenever I type any sudo command I get this "sudo: effective uid is not 0, is sudo installed setuid root?".
    How do I fix it ?
    Any help will be appreciated
    Thank you!

    Additional info:
    Ubuntu 13.10 32-bit

  2. #2
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    5,148
    Distro
    Xubuntu 19.10 Eoan Ermine

    Re: Sudo problem

    Something must be wrong with the ownership or permissions of sudo. Run
    Code:
    ls -l /usr/bin/sudo
    to check. In my case it's
    Code:
    -rwsr-xr-x 1 root root 155008 feb 10 20:16 /usr/bin/sudo
    If permissions or owner are different in your case, boot into recovery mode and fix it.
    Code:
    #To mount the file system rw
    mount -o rw,remount /
    #To fix permissions (if applicable)
    chmod 4755 /usr/bin/sudo
    #To fix ownership (if applicable)
    chown root:root /usr/bin/sudo
    However, without knowing the cause of this problem, chances are that more can be broken. Better to check. Are there more files in /usr/bin with strange owner or permissions? These problem can quickly grow out of hand, making recovery almost impossible.

  3. #3
    Join Date
    Mar 2014
    Beans
    17

    Re: Sudo problem

    I got this
    Code:
     -rwsr-xr-x 1 grumpycat root 123328 Mar 11 17:56 /usr/bin/sudo
    when I ran
    Code:
    ls -l /usr/bin/sudo
    . I am bit of a noob so how do I see if files in '/usr/bin' have weird permissions ? I will now get into GRUB and try it and come back to you
    Thank you!

  4. #4
    Join Date
    Mar 2014
    Beans
    17

    Re: Sudo problem

    I tried the way you said and it still doesn't work But, sudo did work in the GRUB root terminal not quite sure why it doesn't work in the normal one

  5. #5
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    11,135
    Distro
    Ubuntu

    Re: Sudo problem

    Quote Originally Posted by josephdaniel2 View Post
    I am bit of a noob so how do I see if files in '/usr/bin' have weird permissions ?
    Run
    Code:
    ls -l /usr/bin
    will list all the files inside that directory, with both the permissions and ownership.
    Quote Originally Posted by josephdaniel2 View Post
    I tried the way you said and it still doesn't work But, sudo did work in the GRUB root terminal not quite sure why it doesn't work in the normal one
    When in root, sudo become moot, since sudo invokes root.

    But in the recovery mode, did you follow the remount command?
    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  6. #6
    Join Date
    Mar 2014
    Beans
    17

    Re: Sudo problem

    Yes, I did use
    Code:
    mount -o rw,remount /
    I pasted what I got from "ls -l /usr/bin" here
    Last edited by josephdaniel2; May 8th, 2014 at 06:08 AM.

  7. #7
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    11,135
    Distro
    Ubuntu

    Re: Sudo problem

    Your ownership problems seem to go beyond just the /usr.bin/sudo file.
    That whole directory is owned by grumpycat.
    (well except /usr/bin/sudo, ironically)

    I wonder if it goes even further up the chain
    What's the output of both
    Code:
    ls -l /usr
    and
    Code:
    ls -l /
    The permissions themselves, seem fine.
    BTW
    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  8. #8
    Join Date
    Mar 2014
    Beans
    17

    Re: Sudo problem

    I pasted the output here.

  9. #9
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    5,148
    Distro
    Xubuntu 19.10 Eoan Ermine

    Re: Sudo problem

    First of all,
    Code:
    #From your post
    -rwsr-xr-x 1 grumpycat root        123328 Mar 11 17:56 /usr/bin/sudo
    #From the long output
    -rwxr-xr-x 1 root      root        123328 Mar 11 17:56 sudo
    I see that you somehow also lost the setuid bit now. Have you tried chmodding the entire directory?

    For some reason you chowned the entire /usr/bin directory. Luckily the groups are still correct and all files should be owned by root, so this can be fixed. Boot into recovery mode, remount the file system rw and run this command:
    Code:
    chown -R root /usr/bin
    This is not a full fix yet, as I see you now somehow lost your setuid and setgid bits. These have to be fixed manually and one by one.
    Code:
    #To add the setuid bit
    chmod 4755 /usr/bin/filename
    
    #To set the setgid bit
    chmod 2755 /usr/bin/filename
    
    #To set both the setuid bit and the setgid bit
    chmod 6755 /usr/bin/filename
    On my system the following files in /usr/bin have the setuid bit:
    Code:
    chfn
    chsh
    gpasswd
    lppasswd
    mtr
    newgrp
    passwd
    pkexec
    sudo
    traceroute6.iputils
    The following have the setgid bit:
    Code:
    bsd-write
    chage
    crontab
    dotlockfile
    expiry
    mail-lock
    mail-touchlock
    mail-unlock
    mlocate
    ssh-agent
    wall
    And this one has both (note the capital letter):
    Code:
    X
    Your system however may be different.

    You're getting close to the point where reinstalling is the fast way out.

    As to the cause of all this, I see a file named Torrent-Video-Player, belonging to your group and created yesterday, so I think that you chowned the directory to give yourself write access to copy that file there. That's not the right way. Better is to give yourself temporary root access with sudo to get the right to copy the file. Or even better, don't copy things there manually, but leave the /usr/bin directory only for files installed via the package manager. If you want to install something manually, put it in /usr/local/bin/.

  10. #10
    Join Date
    Mar 2014
    Beans
    17

    Re: Sudo problem

    Alright, I guess I will be re-installing Ubuntu then. Thank you for your time and effort both of you I will mark this thread as solved.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •