0

In a stroke of sheer brilliance, I just chmod 750'ed my /usr and /etc directory on my VPS. Now, whenever I run sudo, I get -bash: sudo: command not found. Is there any way you can think of for me to restore access?

I tried to scp sudo over to the computer, but got a

bash: /etc/bash.bashrc: Permission denied
bash: scp: command not found
lost connection

If you can figure this one out, you're a genius.

dwlz
  • 891
  • 3
  • 10
  • 19

4 Answers4

3

do su root instead of sudo

since su is often in /bin, you should not be impacted by your mistake

of course this requires you to know the root passwd...

Brad Clawsie
  • 411
  • 2
  • 7
3

Can you get a console to the machine? If so, reboot into recovery mode or some such thing (add kernel opts init=/bin/sh will drop a root shell). Then you'll be root, and can chmod as needed.

Other options include doing a bare metal restore (you've got a backup, right?) (If you don't you might be able to cobble something together from whatever is in /bin)

askvictor
  • 854
  • 3
  • 15
  • 28
0

Some VPS companies have web console access enabled. Check also that out.

0

Perhaps use netcat to transfer sudo over? At least on my Ubuntu (karmic) machine netcat is in /bin.

Unfortunately having the file won't help much since you'll need it to be setuid root for it to work and you won't have the permissions to make it so.

mark
  • 2,325
  • 14
  • 10