0

I accidentally gave all permissions of my system to another user who has neither a password nor a home directory.

I have complete physical access to the computer, and I'm currently logged in via SSH with key into the system as my user named "chronove"... the user chronove had access to sudo rights, however those are now gone as I ran the command:

$ sudo chown -R mc:mc /

To give you some more information:

$ sudo
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

and

$ ll /usr/bin/sudo
-rwxr-xr-x 1 mc mc 140944 Jan 14 00:41 /usr/bin/sudo*

I cannot access any other instance to the server via SSH or FTP to make any backups. My initial plan to solve this issue was to grab a backup of everything needed and reinstall the Ubuntu server. It seems I got read rights to all necessary files, however i'm unsure as to move several zip files across the only SSH connection I have (which would break on restart).

marked as duplicate by Zanna, Pilot6, Elder Geek, Jakuje, Eric Carvalho May 7 '17 at 1:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 5
    You will need to re-install. You can do this by MOUNTING AND NOT FORMATTING any of the partition, including root. That should leave all your personal files as is. Maybe you still run into trouble but it will be less problematic than the current situation. – Rinzwind May 6 '17 at 17:58
  • Well, i expect this command to make user mc and group mc to owner of ALL files... i didnt want to run this command as i wasnt done typing... sadly hit enter... About mounting, simply boot from usb and somewhat mount the drive, copy over all needed files ? – Chronove May 6 '17 at 18:01
  • No boot up with the live dvd and go through the installation process. During the partition stage pick "something else", pick your old / partition, mount / with the same filesystem (likely ext4) but do not format, same for other partitions, also do not pick format. Be sure to check before you hit continue. – Rinzwind May 6 '17 at 18:04
  • To be extra safe: you can make backup when booting from the live session by mounting your disks and copying your files over to an USB stick. – Rinzwind May 6 '17 at 18:05
  • yep, seems like you found another one. Guess i didnt check hard enough... However i got a solution for myself for making a backup... i got an apache server running on the machine, so right now i simply copy all files i needed into /var/www/html/ and download them from another computer in the network ( about security, im the only person in this network, no open ports or anything ) – Chronove May 6 '17 at 18:26
0

I remembered having an apache server running on the system. As i have read rights as user chronove, yet i cant just type everything of the SSH console ( Putty ), so i can just copy all files i needed into the websites directory.

for example:

cp -R /home/chronove/MY_FILES/ /var/www/html/dl/

After copying all files i can copy them off the website from another computer ( found this program https://sites.google.com/site/visualwget/a-download-manager-gui-based-on-wget-for-windows which helps downloading a lot of folders ) on the network. After that reinstall Linux Ubuntu Server and there we go!

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