rifqi
Posts: 1
Joined: Sun Dec 08, 2019 4:11 am

access root user without root?

Sun Dec 08, 2019 4:22 am

im using raspbian lite to host a website and used cyberdyck for sftp. most files didn't allow me to access them so i ran "sudo chmod 777 (directory name) -R" on the folder i wanted to have permission to access. i thought if i ran the previous command to the root directory "/" it would make all folders accessable but it made them all unaccesable and sudo dosent work. can someone help tell me how to access root user without sudo so i can fix this?

User avatar
topguy
Posts: 6527
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: access root user without root?

Sun Dec 08, 2019 3:00 pm

You have probably broken the security of you whole system so I would suggest to find a new SD card and install the software again there and then see if you can extract the necessary files from the old card.

You could access the SD card from another linux system with an SD-card reader. And while you maybe could fix the permissions this way too, it could be a lot of work.

GlowInTheDark
Posts: 744
Joined: Sat Nov 09, 2019 12:14 pm

Re: access root user without root?

Sun Dec 08, 2019 3:12 pm

Note that one of the things that got chmod'd was /usr/bin/sudo - you chmod'd it to 777, when it needs to be 47xx (the x's don't really matter) in order to work. That's why sudo doesn't work anymore.

Yes, you need to re-install the OS.

P.S. Actually, you could do the init=/bin/bash trick - this would allow you to boot up into a root shell. From there, you could at least look around and maybe fix /usr/sbin/sudo. But note that everything else on the system is still hosed, so you really do need to just re-install it.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

trejan
Posts: 2237
Joined: Tue Jul 02, 2019 2:28 pm

Re: access root user without root?

Sun Dec 08, 2019 3:35 pm

What they said ^. Also some programs like the SSH daemon actually check the permissions on its files and will refuse to work if they're wrong.

You need to reinstall Raspbian. It would take ages to fix your current install.

Return to “Troubleshooting”