copy a directory with all rights and permissions to the USB flash drive
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
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.
Hi there. As lleb said, native Windows file systems like FAT and NTFS will not preserve Unix file ownership and permissions. Depending on your needs, you might want to repartition your flash drive (after backing up your data) and create two partitions, one that you will initialize as FAT (or NTFS) and the other as ext3 or ext4. Then create a directory in the ext partition and give it read & write permissions for your user: that's where your data will go.
Another command that will preserve file ownership and permissions, as well as timestamps and links, is 'cp -a' (i.e. "archive", which has the same effect as 'cp -dR --preserve=all'). See 'man cp' for reference.
Last edited by Philip Lacroix; 12-14-2014 at 04:26 PM.
I know of rsync, but never got into using it. Anyone tell me what's wrong with just the cp command? You can use the -p option to preserve, the -r option to recurse directories, and the -f option to say "make it happen!"
to preserve everything (owner/group, permissions, timestamps, symlinks, extended attributes). "-pr" is not enough, it misses extended attributes and links (copies links as regular files).
Just for being complete, it is indeed possible to store a directory tree with preserved permissions on FAT/NTFS file systems, if you use tar for the job.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.