Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to mount windows share in Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to mount windows sharing in Linux". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to mount windows sharing in Linux" can help you solve the problem.

Before we begin,

To do this, you need to use the command line. The process is very simple, but you need to edit the / etc/fstab file, so be careful. Also, I assume that you have made Samba work properly, you can manually mount the share from the Windows network to your Linux machine, and know the IP address of the shared host.

Create your mount point

The first thing we need to do is to create a folder that will serve as a shared mount point. For simplicity, let's name this folder share and put it under / media. Open your terminal and execute the following command:

Sudo mkdir / media/share installs some software

Now we have to install a system that allows cross-platform file sharing; this system is cifs-utils. In the terminal window, enter:

Sudo apt-get install cifs-utils

This command also installs all cifs-utils dependencies.

After the installation is complete, open the file / etc/nsswitch.conf and locate this line:

Hosts: files mdns4_minimal [NOTFOUND=return] dns

Edit the line to make it look like this:

Hosts: files mdns4_minimal [NOTFOUND=return] wins dns

Now you need to install windbind so that your Linux machine can resolve Windows machine names in the DHCP network. Execute in the terminal:

Sudo apt-get install libnss-windbind windbind

Restart the network service with this command:

Sudo service networking restart mounts the network driver

Now we are going to map the network drive. Here we have to edit the / etc/fstab file. Before you make your first edit, back up the following file with this command:

Sudo cp / etc/fstab / etc/fstab.old

If you need to restore this file, execute the following command:

Sudo mv / etc/fstab.old / etc/fstab

Create an authentication information file in your home directory. Smbkeeper. Add your username and password to this file, like this (USER and PASSWORD are replaced with the actual username and password):

Username=USERpassword=PASSWORD

You need to know the group ID (GID) and user ID (UID) of the user who mounted the drive. Execute the command:

Id USER

USER is your actual user name, and you should see messages like this:

Uid=1000 (USER) gid=1000 (GROUP)

USER is the actual user name and GROUP is the group name. The numbers before (USER) and (GROUP) will be used in the / etc/fstab file.

It's time to edit the / etc/fstab file. Open that file in your editor and add the following line to the end of the file (replace the following all-uppercase field and the IP address of the remote machine):

/ / 192.168.1.10/SHARE / media/share cifs credentials=/home/USER/.smbcredentials,iocharset=uft8,gid=GID,udi=UID,file_mode=0777,dir_mode=0777 0 0

Note: the above should be on the same line.

Save and close that file. Execute the sudo mount-a command, and the share will be mounted. Take a look at / media/share, you should be able to see the files and folders on that network share.

Sharing is simple.

With cifs-utils and Samba, mapping network sharing on a Linux machine is incredibly simple. Now, you no longer have to manually remount those shares every time the machine starts up.

This is the end of the introduction to "how to mount windows sharing in Linux". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report