Permission denied to create a symbolic link; sudo errors out

16,851

Seems like /usr/bin/sudo is broken as mentioned. You can try to fix it by booting your linux machine in recovery mode and fixing it by running the commands:

  • Change owner back to root (uid 0) chown root:root /usr/bin/sudo
  • Fix permissions ONLY IF THEY ARE INCORRECT. Run ls -l /usr/bin/sudo and permissions should be -rwsr-xr-x. If they are not, fix them by running chmod 4755 /usr/bin/sudo.

If all goes well then you should have sudo back!

Share:
16,851

Related videos on Youtube

Mr world wide
Author by

Mr world wide

Updated on September 18, 2022

Comments

  • Mr world wide
    Mr world wide over 1 year

    I am trying to install phalcon development tools. In the documentation they said:

    Create a symbolic link to the phalcon.php script:

    ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon
    chmod ugo+x /usr/bin/phalcon
    

    and after connecting to my Ubuntu server, at the step of creating symbolic link to the phalcon.php script I get an error:

    ubuntu@ip-000-00-0-00:/$ sudo ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon
    sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
    

    How can I complete the installation?

    When I try without sudo I get:

    ubuntu@ip-000-00-0-00:/$ ln -s ~/phalcon-devtools/phalcon.php /usr/bin/phalcon
    ln: failed to create symbolic link ‘/usr/bin/phalcon’: Permission denied
    

    Documentation which I followed

    I have tried all the answers from this question but still getting same errors: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

    • Mr world wide
      Mr world wide over 6 years
      i have tried all the answers but still im getting the same errors.
    • Zanna
      Zanna over 6 years
      seems like you've broken sudo - or do you only get this error when you try to make this particular symbolic link? Could you tell us about your environment?
    • vidarlo
      vidarlo over 6 years
      Can you provide the output of ls -l /usr/bin/sudo? It looks like sudo's permissions are messed up. The sudo binary needs the setuid bit, and has to be owned by root.