Linux Mount Shared folders

Source: Internet
Author: User
Tags password protection

1. Background

Typically there are scenarios where developers write code in Windows and then compile in the Linux environment, and we can use the Mount command to hook code directly into a Linux environment so that shared folders on Windows are like a folder in a Linux environment.

2. Sharing folders on Windows

1. Select the folder you want to share-right---sharing options--share: Select everyone so that any user can access it.

2. After the sharing is complete, you can pass other machine test that can access your host, address format: \\xxx.xxx.xxx.xxx\share, \ \ Your ip\\ your shared folder name

Note By default, Windows shared folders are shared only if they have a password set for the computer. There are two ways to solve this problem:

1. Set the password honestly.

2. In the network and Sharing Center, turn off the shared folder password protection

3. Mount the shared folder on Linux

1. First create the directory you want to map, such as the directory I created is: /root/share/

2. Mount the mount command:

Mount-t cifs//192.168.1.120/share/root/share-o username=share,password=share,rw,file_mode=0777,dir_mode=0777, Setuid=0,setgid=0

which

1)//1962.168.1.120/share ip/shared file name for Windows host

2)/root/share is a mapped folder on Linux

3) Username=share,password=share represents the user name and password on Windows,

4) RW, File_mode, Dir_mode Permissions for folders and files on Linux

  5) setuid=0, setgid=0 Linux User ID and group ID, this must be set, if not set, even if the 4th step to increase the permissions, Linux still can not modify the file. Uid=0 and Gid=0, which represents the root user

4. View Mounts
can also be viewed using the # mount
5. Unload Mount
Using the umount command:   umount  Root/share

If the file is occupied, the Omount command fails with the following prompt:target is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))

1) First switch to another directory try, if not, it may be that other processes occupy the file

2) Use the # fuser command to view: Fuser/root/share See which process is occupied, and then kill the process at Umount.

Linux Mount Shared folders

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.