2

I am trying to save my files on my Hard Drive that has a crashed OS. I created a Bootable USB with Ubuntu and successfully booted.

I can see my folders, but I can't actually open them because I don't have permission.

I tried to do this:

sudo chmod 777 -R Pictures

Where Pictures is the name of the folder I want to change permissions to.

All I want to be able to do is to copy the folders & files from my Hard Drive to my USB drive.

How do I do that?

3 Answers3

1

Running from a live DVD, if you cannot cd into the folder because of "permission denied" you can use the following command to login as root:

sudo su

Logging in as root is not typically recommended and should only be done as a last resort and not just to be lazy! You can use the following command to log out of root:

exit
mchid
  • 44,904
  • 8
  • 102
  • 162
1

I think you only need the mount option uid=[youruserid]

In a terminal you can type echo $UID or id -u to find out your user id.

If the drive's fs is fat, ntfs, cd-rom, udf, and a few others uid=value will "Set the owner and group of all files" to whose id is specified.

If the partition's already mounted (mount to see it & what device it is, or blkid) you might be able to just use

sudo mount -o remount,uid=[youruserid] /dev/[device] [mountpoint]

where [device] is the "sda1" or "sdc2" or whatever the right drive is, and [mountpoint] is the folder it's mounted to (with full path, often /media/something or similar.
(read [device] and [mountpoint] from the above mount or blkid commands)

Using sudo mount -o remount,uid=[youruserid] /dev/[device] alone might work, definitely works if there's an fstab entry for it.

Xen2050
  • 8,943
0

It probably has to do with how the drive is mounted. If the drive is not mounted with proper ownership, you wont be able to access it. unmount the drive with umount. Then mount it again with the proper permissions: Lets say your UID is 1000 and the drive is a FAT partition then your mount statement should look a bit like this

sudo mount -t vfat /dev/sdwhateveryourdriveis ~/mnt -o uid=1000,gid=1000,utf8,dmask=027,fmask=137

This options flag (-o) should set the proper permissions for the directories on your drive. use the dmask and fmask values above and you your UID for uid

RBF06
  • 101