0

I accidentally changed access rights on / for my Ubuntu 16.04 using sudo chmod 466 /. I was supposed to change access rights for a file but instead I accidentally executed a chmod on / (root directory). Of course now I can't access the operating system and I would like to recover some files from it.

Is there a way that I can change access rights for / again so that I may recover my operating system and the files stored within it? If not is there at least a way that I can recover my files from it before I reinstall the entire system again?

I tried pressing F2 to enter the terminal before the system tries to load (since it can't load now, or at least the graphical UI won't load), and then logging in but since the permissions now don't allow write or execute it says that I don't have permissions to access it. I also tried executing a chmod 777 / while in terminal but that didn't do much good either, or maybe I did something wrong there... I tried looking for an answer to this question online but all I can find is how to chmod specific files and directories within the system.

The system is encrypted and all I am able to do now is to decrypt the disk before the system starts to load, but after that I can't do much. If anybody could help me with this it would be much appreciated.

-- Update -----

Ok, so this is where I am at right now:

I used a USB with a live Ubuntu system on it by clicking on the Try Ubuntu option and then using the terminal to change permissions for / of my system with sudo chmod 777 -R for the hard disk where my Ubuntu OS is installed. Now I can log in to the system again but now when I log in all my settings are gone and I can't access my files. It's like accessing a fresh installation of Ubuntu 16.04 even though I didn't install the system again. I just used the option Try Ubuntu from the live Ubuntu USB.

When I try to access my home directory which was also encrypted I can't see my files. All I can see are the default directories like Desktop, Documents, Downloads, Music, Pictures, Public etc. but the directories that I created are no longer there. There is a file though called "Access-Your-Private-Data.desktop" and when I click on it it launches a Terminal and asks form my login password. After I type in my login password nothing happens and I still don't see a new directory with all my files that were encrypted in my old home directory or anything like that. Can anybody help me out with this? How can I recover my files from that directory?

4
  • 1
  • I'd try to interrupt the boot process, select Advanced options, select recovery, get a command prompt, issue mount -o rw,remount / to remount / as writeable, then issue chmod 755 / to restore permissions. Then reboot and see if that helps. Jul 7, 2016 at 9:12
  • @JeffreyRoss That won't work this way.
    – Pilot6
    Jul 7, 2016 at 9:15
  • Pilot6, I don't think this is a duplicate of that question since I looked at it, but it doesn't seem to deal with the same kind of problem. Of curse if you could point me to that question and its answers and tell me how I can use them to solve my problem I would be grateful, but so far I haven't found that question or its answers useful for solving my problem. On the other hand I did manage to kind of regain access to my account as I described in my updated question, but I still can't recover my files from my encrypted Home folder even though I am using the correct password. Jul 9, 2016 at 13:59

2 Answers 2

0

Ok, so this is what I did in the end... I lost the home directory decryption key and without that there really wasn't much I could do. I had to reinstall my system, but fortunately the data loss wasn't too big, only a few files that I could do without in the end. Since I backed up the important things before I got locked out of my account I could copy back the important data once I reinstalled the system.

I know this answer may disappoint others who may find themselves in a similar situation, but this is what I did in the end. I just had to do a clean install and copy all my data back from my backup drive. This time I made sure I save the home decryption key on my external drive.

I guess my advice would be to make sure you save your home decryption password and back up your data regularly.

-3

I think It's all there if you still have the encryption key. You can try a live usb ubuntu image See this post about mounting encrypted volumes.

Your volume is probably encrypted with LUKS, here's how to mount it:

You need:

sudo apt-get install cryptsetup

To decrypt the volume:

sudo cryptsetup luksOpen /dev/sda1 my_encrypted_volume

Now you can mount it as usual:

sudo mkdir /media/my_device
sudo mount /dev/mapper/my_encrypted_volume /media/my_device

To lock the container again, it needs to be unmounted first:

sudo umount /media/my_device
sudo cryptsetup luksClose my_encrypted_volume

To automatically put it in the /media location, use the udisks tool

sudo udisks --mount /dev/mapper/my_encrypted_volume
2
  • Please do not post link only answers.
    – Pilot6
    Jul 7, 2016 at 9:11
  • The problem never was decrypting my hard disk where my OS is installed. It was accessing the system once the disk is decrypted and the OS starts loading. I did manage to kind of gain access back to my account as I described in the update, but I still can't access my files (also described in the update of my question). If you or anyone else can help me out with that, that would be much appreciated. Jul 9, 2016 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .