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.
do
su root
instead ofsudo
since
su
is often in/bin
, you should not be impacted by your mistakeof course this requires you to know the root passwd...
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)
Some VPS companies have web console access enabled. Check also that out.
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.