To mount a Windows shared folder in Linux in a cifs manner

Source: Internet
Author: User

Assuming that the Winddows machine IP is 1.1.1.1, the D:\source directory is shared and the share is named SRC. There are user User1 in this system.

The user User2 under the Linux system wants to mount it to the/HOME/USER2/SRC2 directory.

Then execute the following command.

sudo Mount // 1.1.1.1/src/home/user2/src2

To automatically get the IP of the window machine, as follows (tested on SuSE).

sudo Mount // ' Who Am I | cut-d\ (-f2 | cut-d\)-f1 '/src/home/user2/src2

This way the owner and group of the/HOME/USER2/SRC2 directory that is mounted are root, inconvenient to use, and you want the owners and groups to be user2. Then the following can be done.

sudo Mount -T cifs-ouser=user1,nolock,nounix,noserverinfo,noserverino,uid= 'ID -u ', gid= 'ID // ' Who Am I | cut-d\ (-f2 | cut-d\)-f1 '/src/home/user2/src2

After that, you have to lose two times the password. The first is the password for the root user in the Linux system, and the second is the User1 password in the Windows user. Not convenient. If you have root privileges, you can change it as follows, eliminating the step of losing the root user password.

To modify the configuration file/etc/sudoers, add the following line (if it is already relevant, change it directly on the related line)

User2    all= (root) nopasswd:/bin/Mount,/bin/umount or user2    all = (all) all, (root) nopasswd:/bin/Mount,/bin/umount

To mount a Windows shared folder in Linux in a cifs manner

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.