Copying Folder while Preserving Permissions/Ownership Error: operation not permitted
I am trying to copy a folder while preserving ownership. When I use the command:
sudo cp -R -p /var/lib/mysql /newpath
the files copy but the ownership changes (my username becomes the owner on the new files) and I get an error message saying that cp: failed to preserve ownership for '/newpath/subdirectory' : Operation not permitted
for each subdirectory and file in the copied folder. Trying to switch back ownership on the copied files produces the same error (with chown in the place of cp).
sudo chown -R username:group /newpath
I am trying to copy a mysql data directory folder to my second hard drive in such a way that I can then use it as the database directory for the mysql server (username mysql) with webmin.
permissions mysql ownership
add a comment |
I am trying to copy a folder while preserving ownership. When I use the command:
sudo cp -R -p /var/lib/mysql /newpath
the files copy but the ownership changes (my username becomes the owner on the new files) and I get an error message saying that cp: failed to preserve ownership for '/newpath/subdirectory' : Operation not permitted
for each subdirectory and file in the copied folder. Trying to switch back ownership on the copied files produces the same error (with chown in the place of cp).
sudo chown -R username:group /newpath
I am trying to copy a mysql data directory folder to my second hard drive in such a way that I can then use it as the database directory for the mysql server (username mysql) with webmin.
permissions mysql ownership
What is the filesystem type of the second hard drive? If ext2/3/4 does it have any extended attributes set (lsattr /newpath
). How is it mounted?
– steeldriver
May 5 '14 at 23:09
File starts on ext4 and goes to fat32.
– Michael
Jun 29 '14 at 1:05
add a comment |
I am trying to copy a folder while preserving ownership. When I use the command:
sudo cp -R -p /var/lib/mysql /newpath
the files copy but the ownership changes (my username becomes the owner on the new files) and I get an error message saying that cp: failed to preserve ownership for '/newpath/subdirectory' : Operation not permitted
for each subdirectory and file in the copied folder. Trying to switch back ownership on the copied files produces the same error (with chown in the place of cp).
sudo chown -R username:group /newpath
I am trying to copy a mysql data directory folder to my second hard drive in such a way that I can then use it as the database directory for the mysql server (username mysql) with webmin.
permissions mysql ownership
I am trying to copy a folder while preserving ownership. When I use the command:
sudo cp -R -p /var/lib/mysql /newpath
the files copy but the ownership changes (my username becomes the owner on the new files) and I get an error message saying that cp: failed to preserve ownership for '/newpath/subdirectory' : Operation not permitted
for each subdirectory and file in the copied folder. Trying to switch back ownership on the copied files produces the same error (with chown in the place of cp).
sudo chown -R username:group /newpath
I am trying to copy a mysql data directory folder to my second hard drive in such a way that I can then use it as the database directory for the mysql server (username mysql) with webmin.
permissions mysql ownership
permissions mysql ownership
asked May 5 '14 at 22:21
MichaelMichael
95216
95216
What is the filesystem type of the second hard drive? If ext2/3/4 does it have any extended attributes set (lsattr /newpath
). How is it mounted?
– steeldriver
May 5 '14 at 23:09
File starts on ext4 and goes to fat32.
– Michael
Jun 29 '14 at 1:05
add a comment |
What is the filesystem type of the second hard drive? If ext2/3/4 does it have any extended attributes set (lsattr /newpath
). How is it mounted?
– steeldriver
May 5 '14 at 23:09
File starts on ext4 and goes to fat32.
– Michael
Jun 29 '14 at 1:05
What is the filesystem type of the second hard drive? If ext2/3/4 does it have any extended attributes set (
lsattr /newpath
). How is it mounted?– steeldriver
May 5 '14 at 23:09
What is the filesystem type of the second hard drive? If ext2/3/4 does it have any extended attributes set (
lsattr /newpath
). How is it mounted?– steeldriver
May 5 '14 at 23:09
File starts on ext4 and goes to fat32.
– Michael
Jun 29 '14 at 1:05
File starts on ext4 and goes to fat32.
– Michael
Jun 29 '14 at 1:05
add a comment |
1 Answer
1
active
oldest
votes
FAT32 (or any FAT-type filesystem for that matter) does not support permissions. Any file copied to a FAT filesystem will appear with default owner/group/mode attributes, depending on how the filesystem was mounted.
If you need to preserve these attributes, use a different filesystem. Most (if not all) Unix filesystems (ext*, ReiserFS, btrfs and a bunch of others) supported by Linux will work, so will NTFS to an extent (not strictly a Unix filesystem but designed with a certain degree of Unix compatibility in mind).
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f461403%2fcopying-folder-while-preserving-permissions-ownership-error-operation-not-permi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
FAT32 (or any FAT-type filesystem for that matter) does not support permissions. Any file copied to a FAT filesystem will appear with default owner/group/mode attributes, depending on how the filesystem was mounted.
If you need to preserve these attributes, use a different filesystem. Most (if not all) Unix filesystems (ext*, ReiserFS, btrfs and a bunch of others) supported by Linux will work, so will NTFS to an extent (not strictly a Unix filesystem but designed with a certain degree of Unix compatibility in mind).
add a comment |
FAT32 (or any FAT-type filesystem for that matter) does not support permissions. Any file copied to a FAT filesystem will appear with default owner/group/mode attributes, depending on how the filesystem was mounted.
If you need to preserve these attributes, use a different filesystem. Most (if not all) Unix filesystems (ext*, ReiserFS, btrfs and a bunch of others) supported by Linux will work, so will NTFS to an extent (not strictly a Unix filesystem but designed with a certain degree of Unix compatibility in mind).
add a comment |
FAT32 (or any FAT-type filesystem for that matter) does not support permissions. Any file copied to a FAT filesystem will appear with default owner/group/mode attributes, depending on how the filesystem was mounted.
If you need to preserve these attributes, use a different filesystem. Most (if not all) Unix filesystems (ext*, ReiserFS, btrfs and a bunch of others) supported by Linux will work, so will NTFS to an extent (not strictly a Unix filesystem but designed with a certain degree of Unix compatibility in mind).
FAT32 (or any FAT-type filesystem for that matter) does not support permissions. Any file copied to a FAT filesystem will appear with default owner/group/mode attributes, depending on how the filesystem was mounted.
If you need to preserve these attributes, use a different filesystem. Most (if not all) Unix filesystems (ext*, ReiserFS, btrfs and a bunch of others) supported by Linux will work, so will NTFS to an extent (not strictly a Unix filesystem but designed with a certain degree of Unix compatibility in mind).
answered 9 hours ago
user149408user149408
561715
561715
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f461403%2fcopying-folder-while-preserving-permissions-ownership-error-operation-not-permi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is the filesystem type of the second hard drive? If ext2/3/4 does it have any extended attributes set (
lsattr /newpath
). How is it mounted?– steeldriver
May 5 '14 at 23:09
File starts on ext4 and goes to fat32.
– Michael
Jun 29 '14 at 1:05