Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-19-2009, 06:08 PM
|
#1
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
|
Setting permissions for files from Windows
I have a flash drive formatted as FAT32 with my data on it. I copied all my photos from it but realized that the permissions are totally garbled: the flags say "????????" and some of them even say "Permission Denied". Because there is no owner specified, I cannot run chmod.
How to fix this?
(and I am really considering to reformat the flash drive to a Linux filesystem now)
|
|
|
12-19-2009, 06:11 PM
|
#2
|
Member
Registered: Nov 2009
Location: Alabama
Distribution: EndeavourOS
Posts: 650
Rep:
|
can you chown the files to root and then chmod?
|
|
|
12-19-2009, 06:23 PM
|
#3
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
Code:
# chown -R root:root Pictures/*
Didn't help.
|
|
|
12-19-2009, 06:41 PM
|
#4
|
Member
Registered: Nov 2009
Location: Alabama
Distribution: EndeavourOS
Posts: 650
Rep:
|
I've never had a problem copying from usb drive that came from windows machine. Hmmm, is the file possibly corrupt?
|
|
|
12-19-2009, 06:45 PM
|
#5
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
It does sound like the filesystem is damaged. By the way, you can't use chmod or chown for fat32, but you can for files you copied to a linux partition.
First eject the flash drive and then reinsert it. Maybe it will mount properly.
You can also attempt a repair.
I'd recommend using dd or ddrescue to create an image file of the flashdrive. Then run "/sbin/fsck.vfat <imagefile>" to try to repair it. You might want to create a copy of the image file and work on the copy. That way, if you cause damage to the file, you can delete it and make another copy.
If this doesn't work, you could use "testdisk" to try to recover files from the image.
Last edited by jschiwal; 12-19-2009 at 06:47 PM.
|
|
|
12-19-2009, 08:14 PM
|
#6
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
It worked this time.
I actually first copied them when I just installed Fedora a few weeks ago.
And I still want to format the flash drive with something like ext3/ext4, because losing all your file permissions is still a big pain.
|
|
|
12-19-2009, 08:24 PM
|
#7
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
I reformatted the drive to ext4 using fdisk and mkfs.ext4.
Now I will be putting my stuff on it.
|
|
|
12-19-2009, 08:33 PM
|
#8
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
I noticed that even the successfully copied files got corrupted by running chmod -R!!!
Thankfully I had another flash drive with the same data on it just in case. I was hoping to remove the executable permission from my pictures.
|
|
|
12-19-2009, 10:15 PM
|
#9
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
FYI. For a vfat filesystem, you can use the fmask options when mounting the drive. This sets the permissions of all of the files on the (mounted) filesystem. You are correct that you loose linux ownership, groups & permissions when copying files to a fat32 filesystem. You can use tar to backup your pictures on a fat32 filesystem. Then when restoring them onto a Linux filesystem, you will restore the permissions as well.
If you still see question marks after formatting the flash drive, your drive is bad and should be replaced.
For a flash drive, you may want to mount it using the "noatime" option to reduce the number of writes.
Last edited by jschiwal; 12-19-2009 at 10:17 PM.
|
|
|
All times are GMT -5. The time now is 03:26 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|