Change permissions of windows mounted folder from linux












0














I mounted windows share to linux(rhel7) using



mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt


I successfully mounted it. From Linux I tried to change permissions on the mounted folder then it gave me the error.



chmod: changing permissions of ‘/mnt/’: Permission denied



chmod -R 777 /mnt


How can I change permissions of the mounted folder in Linux?



Is it possible to change permission on the mounted windows folder from Linux command(chmod)?










share|improve this question






















  • Also note that Ask Ubuntu is for Ubuntu related questions you might want to see unix.stackexchange.com for RHEL related questions.
    – Kristopher Ives
    Dec 27 '18 at 11:54


















0














I mounted windows share to linux(rhel7) using



mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt


I successfully mounted it. From Linux I tried to change permissions on the mounted folder then it gave me the error.



chmod: changing permissions of ‘/mnt/’: Permission denied



chmod -R 777 /mnt


How can I change permissions of the mounted folder in Linux?



Is it possible to change permission on the mounted windows folder from Linux command(chmod)?










share|improve this question






















  • Also note that Ask Ubuntu is for Ubuntu related questions you might want to see unix.stackexchange.com for RHEL related questions.
    – Kristopher Ives
    Dec 27 '18 at 11:54
















0












0








0







I mounted windows share to linux(rhel7) using



mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt


I successfully mounted it. From Linux I tried to change permissions on the mounted folder then it gave me the error.



chmod: changing permissions of ‘/mnt/’: Permission denied



chmod -R 777 /mnt


How can I change permissions of the mounted folder in Linux?



Is it possible to change permission on the mounted windows folder from Linux command(chmod)?










share|improve this question













I mounted windows share to linux(rhel7) using



mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt


I successfully mounted it. From Linux I tried to change permissions on the mounted folder then it gave me the error.



chmod: changing permissions of ‘/mnt/’: Permission denied



chmod -R 777 /mnt


How can I change permissions of the mounted folder in Linux?



Is it possible to change permission on the mounted windows folder from Linux command(chmod)?







mount samba cifs mountpoint






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 27 '18 at 11:44









harish chavaharish chava

31




31












  • Also note that Ask Ubuntu is for Ubuntu related questions you might want to see unix.stackexchange.com for RHEL related questions.
    – Kristopher Ives
    Dec 27 '18 at 11:54




















  • Also note that Ask Ubuntu is for Ubuntu related questions you might want to see unix.stackexchange.com for RHEL related questions.
    – Kristopher Ives
    Dec 27 '18 at 11:54


















Also note that Ask Ubuntu is for Ubuntu related questions you might want to see unix.stackexchange.com for RHEL related questions.
– Kristopher Ives
Dec 27 '18 at 11:54






Also note that Ask Ubuntu is for Ubuntu related questions you might want to see unix.stackexchange.com for RHEL related questions.
– Kristopher Ives
Dec 27 '18 at 11:54












2 Answers
2






active

oldest

votes


















0















Is it possible to change permission on the mounted windows folder from
Linux command(chmod)?




No. CIFS much like NTFS is a virtual filesystem so chmod has no affect. And changing the permission of the mount point before anything is mounted to it will have no affect either since the permissions after a mount always replace the permissions before the mount.



If the desired permissions is 777 change your mount command to include those permissions: dir_mode=0777,file_mode=0777. I would also get in the habit of adding the nounix option although for a Windows share it won't do much.



So try this instead:



mount -t cifs -o username=<share user>,password=<share password>,dir_mode=0777,file_mode=0777,nounix //WIN_PC_IP/<share name> /mnt


And I would agree that a better mount point would be something under /mnt rather than /mnt itself.






share|improve this answer





















  • It I tries to change permissions on /mnt/ using chmod 777 /mnt it is giving error permission denied. But If I make new folder in /mnt say /mnt/share then If I tries to change permissions using chmod 777 /mnt/share It is not theowing any error but permissions were not getting changed. Why is this happening?
    – harish chava
    Dec 27 '18 at 13:34










  • /mnt Which I mentioned in the question is in /home/mnt not directly /mnt.
    – harish chava
    Dec 27 '18 at 13:42



















0














Firstly, only root (by default) may change permissions to the /mnt directory itself since it's owned by root:root - so attempting to modify it's permissions will fail as non-root.



You likely want to make this easier on yourself by creating a subdirectory inside /mnt, changing it's permissions, then mounting there.



First unmount anything already:



sudo umount /mnt


Next create a subdirectory where you will mount the share



sudo mkdir /mnt/share


Now change the permissions to be owned by the user you want to modify it:



sudo chown foo:foo /mnt/share


Where foo:foo is for the user foo, which should be your username.



Lastly mount to the /mnt/share location instead:



sudo mount -t cifs -o username=xxx,password=xxx //WIN_PC_IP/<share name> /mnt/share


If you still have problems with the files inside /mnt/share not being owned by the correct user you might need to specify the uid=xxx,gid=xxx in the mount options.






share|improve this answer





















  • I am trying to change permissions using the root user only
    – harish chava
    Dec 27 '18 at 13:29











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104865%2fchange-permissions-of-windows-mounted-folder-from-linux%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0















Is it possible to change permission on the mounted windows folder from
Linux command(chmod)?




No. CIFS much like NTFS is a virtual filesystem so chmod has no affect. And changing the permission of the mount point before anything is mounted to it will have no affect either since the permissions after a mount always replace the permissions before the mount.



If the desired permissions is 777 change your mount command to include those permissions: dir_mode=0777,file_mode=0777. I would also get in the habit of adding the nounix option although for a Windows share it won't do much.



So try this instead:



mount -t cifs -o username=<share user>,password=<share password>,dir_mode=0777,file_mode=0777,nounix //WIN_PC_IP/<share name> /mnt


And I would agree that a better mount point would be something under /mnt rather than /mnt itself.






share|improve this answer





















  • It I tries to change permissions on /mnt/ using chmod 777 /mnt it is giving error permission denied. But If I make new folder in /mnt say /mnt/share then If I tries to change permissions using chmod 777 /mnt/share It is not theowing any error but permissions were not getting changed. Why is this happening?
    – harish chava
    Dec 27 '18 at 13:34










  • /mnt Which I mentioned in the question is in /home/mnt not directly /mnt.
    – harish chava
    Dec 27 '18 at 13:42
















0















Is it possible to change permission on the mounted windows folder from
Linux command(chmod)?




No. CIFS much like NTFS is a virtual filesystem so chmod has no affect. And changing the permission of the mount point before anything is mounted to it will have no affect either since the permissions after a mount always replace the permissions before the mount.



If the desired permissions is 777 change your mount command to include those permissions: dir_mode=0777,file_mode=0777. I would also get in the habit of adding the nounix option although for a Windows share it won't do much.



So try this instead:



mount -t cifs -o username=<share user>,password=<share password>,dir_mode=0777,file_mode=0777,nounix //WIN_PC_IP/<share name> /mnt


And I would agree that a better mount point would be something under /mnt rather than /mnt itself.






share|improve this answer





















  • It I tries to change permissions on /mnt/ using chmod 777 /mnt it is giving error permission denied. But If I make new folder in /mnt say /mnt/share then If I tries to change permissions using chmod 777 /mnt/share It is not theowing any error but permissions were not getting changed. Why is this happening?
    – harish chava
    Dec 27 '18 at 13:34










  • /mnt Which I mentioned in the question is in /home/mnt not directly /mnt.
    – harish chava
    Dec 27 '18 at 13:42














0












0








0







Is it possible to change permission on the mounted windows folder from
Linux command(chmod)?




No. CIFS much like NTFS is a virtual filesystem so chmod has no affect. And changing the permission of the mount point before anything is mounted to it will have no affect either since the permissions after a mount always replace the permissions before the mount.



If the desired permissions is 777 change your mount command to include those permissions: dir_mode=0777,file_mode=0777. I would also get in the habit of adding the nounix option although for a Windows share it won't do much.



So try this instead:



mount -t cifs -o username=<share user>,password=<share password>,dir_mode=0777,file_mode=0777,nounix //WIN_PC_IP/<share name> /mnt


And I would agree that a better mount point would be something under /mnt rather than /mnt itself.






share|improve this answer













Is it possible to change permission on the mounted windows folder from
Linux command(chmod)?




No. CIFS much like NTFS is a virtual filesystem so chmod has no affect. And changing the permission of the mount point before anything is mounted to it will have no affect either since the permissions after a mount always replace the permissions before the mount.



If the desired permissions is 777 change your mount command to include those permissions: dir_mode=0777,file_mode=0777. I would also get in the habit of adding the nounix option although for a Windows share it won't do much.



So try this instead:



mount -t cifs -o username=<share user>,password=<share password>,dir_mode=0777,file_mode=0777,nounix //WIN_PC_IP/<share name> /mnt


And I would agree that a better mount point would be something under /mnt rather than /mnt itself.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 27 '18 at 12:25









Morbius1Morbius1

1,376127




1,376127












  • It I tries to change permissions on /mnt/ using chmod 777 /mnt it is giving error permission denied. But If I make new folder in /mnt say /mnt/share then If I tries to change permissions using chmod 777 /mnt/share It is not theowing any error but permissions were not getting changed. Why is this happening?
    – harish chava
    Dec 27 '18 at 13:34










  • /mnt Which I mentioned in the question is in /home/mnt not directly /mnt.
    – harish chava
    Dec 27 '18 at 13:42


















  • It I tries to change permissions on /mnt/ using chmod 777 /mnt it is giving error permission denied. But If I make new folder in /mnt say /mnt/share then If I tries to change permissions using chmod 777 /mnt/share It is not theowing any error but permissions were not getting changed. Why is this happening?
    – harish chava
    Dec 27 '18 at 13:34










  • /mnt Which I mentioned in the question is in /home/mnt not directly /mnt.
    – harish chava
    Dec 27 '18 at 13:42
















It I tries to change permissions on /mnt/ using chmod 777 /mnt it is giving error permission denied. But If I make new folder in /mnt say /mnt/share then If I tries to change permissions using chmod 777 /mnt/share It is not theowing any error but permissions were not getting changed. Why is this happening?
– harish chava
Dec 27 '18 at 13:34




It I tries to change permissions on /mnt/ using chmod 777 /mnt it is giving error permission denied. But If I make new folder in /mnt say /mnt/share then If I tries to change permissions using chmod 777 /mnt/share It is not theowing any error but permissions were not getting changed. Why is this happening?
– harish chava
Dec 27 '18 at 13:34












/mnt Which I mentioned in the question is in /home/mnt not directly /mnt.
– harish chava
Dec 27 '18 at 13:42




/mnt Which I mentioned in the question is in /home/mnt not directly /mnt.
– harish chava
Dec 27 '18 at 13:42













0














Firstly, only root (by default) may change permissions to the /mnt directory itself since it's owned by root:root - so attempting to modify it's permissions will fail as non-root.



You likely want to make this easier on yourself by creating a subdirectory inside /mnt, changing it's permissions, then mounting there.



First unmount anything already:



sudo umount /mnt


Next create a subdirectory where you will mount the share



sudo mkdir /mnt/share


Now change the permissions to be owned by the user you want to modify it:



sudo chown foo:foo /mnt/share


Where foo:foo is for the user foo, which should be your username.



Lastly mount to the /mnt/share location instead:



sudo mount -t cifs -o username=xxx,password=xxx //WIN_PC_IP/<share name> /mnt/share


If you still have problems with the files inside /mnt/share not being owned by the correct user you might need to specify the uid=xxx,gid=xxx in the mount options.






share|improve this answer





















  • I am trying to change permissions using the root user only
    – harish chava
    Dec 27 '18 at 13:29
















0














Firstly, only root (by default) may change permissions to the /mnt directory itself since it's owned by root:root - so attempting to modify it's permissions will fail as non-root.



You likely want to make this easier on yourself by creating a subdirectory inside /mnt, changing it's permissions, then mounting there.



First unmount anything already:



sudo umount /mnt


Next create a subdirectory where you will mount the share



sudo mkdir /mnt/share


Now change the permissions to be owned by the user you want to modify it:



sudo chown foo:foo /mnt/share


Where foo:foo is for the user foo, which should be your username.



Lastly mount to the /mnt/share location instead:



sudo mount -t cifs -o username=xxx,password=xxx //WIN_PC_IP/<share name> /mnt/share


If you still have problems with the files inside /mnt/share not being owned by the correct user you might need to specify the uid=xxx,gid=xxx in the mount options.






share|improve this answer





















  • I am trying to change permissions using the root user only
    – harish chava
    Dec 27 '18 at 13:29














0












0








0






Firstly, only root (by default) may change permissions to the /mnt directory itself since it's owned by root:root - so attempting to modify it's permissions will fail as non-root.



You likely want to make this easier on yourself by creating a subdirectory inside /mnt, changing it's permissions, then mounting there.



First unmount anything already:



sudo umount /mnt


Next create a subdirectory where you will mount the share



sudo mkdir /mnt/share


Now change the permissions to be owned by the user you want to modify it:



sudo chown foo:foo /mnt/share


Where foo:foo is for the user foo, which should be your username.



Lastly mount to the /mnt/share location instead:



sudo mount -t cifs -o username=xxx,password=xxx //WIN_PC_IP/<share name> /mnt/share


If you still have problems with the files inside /mnt/share not being owned by the correct user you might need to specify the uid=xxx,gid=xxx in the mount options.






share|improve this answer












Firstly, only root (by default) may change permissions to the /mnt directory itself since it's owned by root:root - so attempting to modify it's permissions will fail as non-root.



You likely want to make this easier on yourself by creating a subdirectory inside /mnt, changing it's permissions, then mounting there.



First unmount anything already:



sudo umount /mnt


Next create a subdirectory where you will mount the share



sudo mkdir /mnt/share


Now change the permissions to be owned by the user you want to modify it:



sudo chown foo:foo /mnt/share


Where foo:foo is for the user foo, which should be your username.



Lastly mount to the /mnt/share location instead:



sudo mount -t cifs -o username=xxx,password=xxx //WIN_PC_IP/<share name> /mnt/share


If you still have problems with the files inside /mnt/share not being owned by the correct user you might need to specify the uid=xxx,gid=xxx in the mount options.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 27 '18 at 11:52









Kristopher IvesKristopher Ives

1,88011016




1,88011016












  • I am trying to change permissions using the root user only
    – harish chava
    Dec 27 '18 at 13:29


















  • I am trying to change permissions using the root user only
    – harish chava
    Dec 27 '18 at 13:29
















I am trying to change permissions using the root user only
– harish chava
Dec 27 '18 at 13:29




I am trying to change permissions using the root user only
– harish chava
Dec 27 '18 at 13:29


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104865%2fchange-permissions-of-windows-mounted-folder-from-linux%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕