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