2

I'm facing a weird problem currently. I've a couple logging units based on Rpi at various places which I normally access via remote SSH to monitor things / update program.

For a particular RPi, I'm not able to run any command with sudo which I assume that sudo binary has got corrupted somehow since it's giving me segmentation error. Now my problem is to run any root level command such as sudo apt-get update && sudo apt-get upgrade or replacing sudo binary by dpkg. I will be needing sudo.

Now my question is : Is there any alternative of sudo so that I can get root access and fix this issue ? Please note that I only have remote access to this RPi and hence can't go over there physically to fix this issue or replace this card.

1
  • 4
    I think whatver you do you are stuffed. If sudo is corrupt what else is corrupt? You have no way of knowing the extent of the SD card corruption so can not really trust any data on that SD card.
    – joan
    Aug 8, 2015 at 7:36

1 Answer 1

3

If you have already given the root user a password you could use the su command.

The su command will prompt you for the root password and if correct will log you in as root.

If you haven't already assigned a password to the root user I know of no solution without physical access to the SD card.

7
  • I haven't touched root password. So I guess, I can't use su. Aug 8, 2015 at 7:49
  • There is no harm in trying, you could try raspberry as the password. But I doubt that a password has been assigned. Perhaps also try su and enter a blank password.
    – joan
    Aug 8, 2015 at 7:58
  • Of course you could copy a good sudo binary to your home directory and try the command ./sudo instead of sudo.
    – joan
    Aug 8, 2015 at 8:00
  • Last option is worth trying i.e., good binary option, I will let you know. I tried pi user's password and blank password while trying su but of no use. Aug 8, 2015 at 9:19
  • While copying sudo binary from another pi and running ./sudo, it gives me this error must be owned by uid 0 and have the setuid bit set. So I guess, I will have to change it. Aug 12, 2015 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.