1

I have ended up with problems with ownership and permissions on my computer, probably due to a brainless recursive change of permissions..! I don't know which folder was affected, so I have changed everything back to root ownership, but realise I will never get things back to normal (even if I found a good guide in the first answer here). I now want to backup my files onto USB before I reinstall Ubuntu, but can't get to my USB ports. Have followed these instructions and it looks like Ubuntu is recognising the USB ports, so I guess it has to do with the permissions/ownership problems (as everything has gone haywire with the machine and I guess also the USB ports are affected).

I have tried running the following to find what I need to change to get things working again:

sudo find /usr -exec stat -c '%U %n' {} + | grep -v root

But I don't know what permissions/ownerships I need to change specifically to get the USB working. /media/ should be owned by root according to another machine I have, and it is, so I guess it must be something else. Any ideas? (I'm sorry to have to ask this kind of thing - I guess it is what comes from experimenting too much with too little knowledge)

1

If you have destroyed the ownership and permissions throughout the systems, chances are that the automatic mechanism for mounting the USB drive are busted.

You have two possibilities --- and I would go with the first if you are not an experienced Unix user:

  1. Use a Live disk. Boot from it and choose not to install ("check Ubuntu without installing" or something similar).

    Once in the Live session, use File Explorer to mount your main disk (again, I do not remember the exact procedure, but it's not difficult), insert your USB disk, and backup your files. Maybe you will need to use sudo if your UID is different from the standard one; but you have a full system working and shouldn't be difficult.

  2. Manually backing up your home directory from a root shell --- notice that this is a dangerous process.

    In this case, you drop to a root shell (sudo -i or equivalent) and the insert your USB drive. Although it will not be automounted, you should see in the system log /var/log/syslog something like this:

    [...]
    SYS: Sep  6 12:13:27 samsung-romano kernel: [43555.542311] sd 6:0:0:0: Attached scsi generic sg2 type 0
    SYS: Sep  6 12:13:27 samsung-romano kernel: [43555.542606] sd 6:0:0:0: [sdb] 1957888 512-byte logical blocks: (1.00 GB/956 MiB)
    [...]
    

    The important part is the sdb --- this is how the device is known to the system. You can mount it manually; let's do it under for example /mnt:

    mkdir -p /mnt
    mount /dev/sdb1 /mnt
    

    (normally USB drives are partitioned with just one partition. The above command should work 99% of the times).

    Now you have the USB drive under /mnt. You can copy thing there as root (remember to use cp -a to maintain ownerships and modes) or using tar or whatever. Or you can change the mount point to your normal user and do the copy as your user.

Anyway, check your backup in anther machine before reinstalling everything. And notice that recent Ubuntu do allows a new installation without touching your /home --- although a backup is always recommended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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