Mount mount Windows shared file permissions issue on Linux

Source: Internet
Author: User

You need to set the folder on a shared file on Windows when the server is deployed. After you mount to Linux using the Mount command. File paths and files are accessible, but cannot be written, causing the system to upload files when the prompt "insufficient permissions, no write permission." The permission setting for viewing mounted files with "Ls-l" is drwxr-xr-x, obviously without write permission. Take it for granted that you use chmod to change folder permissions, resulting in insufficient permissions. Neither root nor the current user can modify permissions properly. So no words, I do not know how to carry out.
(Windows permissions Remember whether password Authentication is turned on, public and advanced sharing settings)
When you use the following command to mount a shared folder on Windows Linux, it is found to be accessible in Linux after success, but cannot be modified.

[Plain]View PlainCopy 
    1. MOUNT-T cifs-o username= "* * *", password= "* * *"//windowshost/sharefolder/home/xxx/shared

Using Ls-l shared also discovers that the shared directory owner and user group are root, even if you use sudo chmod and sudo chown to modify the permissions. However, you can add two parameters to achieve the desired effect:

[Plain]View PlainCopy 
    1. MOUNT-T smbfs-o username= "* * *", password= "* *", gid= "* * *", uid= "* * *"//windowshost/sharefolder/home/xxx/shared



The GID, uid in the attribute, is the GID and UID of the user you want to mount. As for this GID and UID, you can use the ID username to obtain, for example, my xxx, the user obtains the GID and UID is 1000.
Both username and password in the above command are accessed for windowshost.


Example: I am using LNMP one-click Install package, run Nginx user's www, I will use the id www query his gid uid and then mount it will not appear the issue of permissions!

Unload mount directory: sudo umount shared

Machine Restart auto mount, Vi/etc/fstab last added:

[Plain]View PlainCopy 
    1. windowshost/sharefolder/home/xxx/shared cifs defaults,auto,username= "xxxx", password= "* * *", gid= "$", uid= "1000 "0 0

Mount mount Windows shared files permissions problem on Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.