In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to deploy Samba to make Linux and Windows file sharing related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that after reading this article on how to deploy Samba to make Linux and Windows file sharing article will have a harvest, let's take a look at it.
Samba is the re-implementation of SMB/CIFS network protocol. As a supplement to NFS, it makes file sharing and printer sharing in Linux and Windows systems easier to implement. Ubuntu systems generally come with samba services, so we don't need to install them separately.
Let's take ubuntu16.04 as an example to illustrate the deployment of Samba services.
1. Introduction to profile parameters
Before we officially start deployment, let's take a look at the detailed parameters of the samba configuration file. Readers who are not very demanding of file sharing services can skip this step. Let's start our trilogy directly. If you want to configure more complex file sharing services, you can refer to this section later.
The configuration file of samba is / etc/samba/smb.conf, and we can accomplish our various requirements by modifying this configuration file.
Global parameter
In global, there are some overall parameters of the host, including the workgroup, the NetBIOS name of the host, the display of the character code, the setting of the login file, whether to use the password and the mechanism of using password authentication, and so on. The main parameters for hostname information in the [global] section are:
Workgroup = name of the workgroup: note that the host group should be the same
Netbios name = the NetBIOS name of the host, each host is different
Server string = a simple description of the host, which can be written at will
In addition, there is information about the login file, including these parameters:
Log file = the file placed by the login file, and the file name may be handled using a variable
Max log size = login file * only how many Kbytes can be reached. If it is greater than this number, it will be dropped by rotate.
There are also password-related parameters, including these:
Security = user, server, domain, share. These four set values represent:
User: use SAMBA's own password database, which is related to the smb passwd file below
Server, domain: use the password of the external host, that is, SAMBA means the client. If you set this project, you also have to provide the set value of password server = IP.
Share: shared data can be shared without a password
Encrypt passwords = Yes means the password is encrypted
Smbpasswd file = the file placed with the password, usually / etc/samba/smbpasswd
Shared file parameter settin
[shared folder name] is a setting of permissions for the directory you open, including parameters such as who can browse the directory and whether you can read and write.
[sharing folder name]: this sharing name is very important, it is just a "code name".
Comment: instructions for sharing folders
Path: the path to the shared folder
Read only: read-only
Public: whether to let all users who can log in see this project
Writable: whether you can write to
Both create mode and directory mode are related to permissions
Valid users = user, this project can specify a specific user who can access this resource.
two。 Deploy open samba services
Create a new shared folder
Sudo mkdir-p / samba/test
Note that you must set the correct permissions for the file.
Chmod-R 777 / samba/test
Configuration parameter file
Open the Samba configuration file with vim
Sudo vim / etc/samba/smb.conf
Note: it is recommended that you delete all the configuration information and then rewrite it all by yourself to avoid confusion of the information.
Modify the configuration file to
[global] workgroup = WORKGROUP server string = Samba Server% v netbios name = ubuntu security = user map to guest = bad user dns proxy = no [temp] path = / samba/test browsable = yes writable = yes guest ok = yes read only = no creat mode=777 force creat mode=777 directory mode=777 force directory mode=777
test
Restart the samba service
Sudo / etc/init.d/samba restart
Enter file://192.168.1.11/ on the browser on ubuntu to see if you can access the shared file ```(please change the ip address to the address of your own server), and it seems that you can access your own shared directory.
Open the explorer on windows and directly enter\\ 192.168.1.11 for direct access. Try to upload the file to the share by dragging and dropping to see if it works properly and how fast it is. Note that the name of the shared folder displayed on the windows side is the name of the folder in the parameter configuration file, in this case temp)
3. Deploy samba services that require passwords
Add users and create shared folders
Create a system user
Sudo useradd user01
Set user password
Sudo passwd user01
Add the system user user01 as the samba user and set the samba login password
Sudo smbpasswd-a user01
View samba users
Sudo pdbedit-L
Create a shared directory
Sudo mkdir-p / samba/data
Directory assigns * permissions
Sudo chmod 777 / samba/data
Change the user to which the directory belongs
Sudo chown root:user1 data
Configuration parameter file
Open the Samba configuration file with vim:
Sudo vim / etc/samba/smb.conf
Modify the configuration file to
[global] workgroup = WORKGROUP server string = Samba Server% v netbios name = ubuntu security = user map to guest = bad user dns proxy = no [data] path = / samba/data browsable = yes writable = yes guest ok = no read only = no valid users=@user1
test
The test is the same as above, enter on the windows side, click on the data folder, and you will be prompted to enter the user and password, enter the corresponding user name and password, and drag and drop the file to test.
4. Bind server ip (optional)
After the server restarts, the router will reassign the ip, which brings great inconvenience to use. We * bind the address of the server to a fixed ip. Here we take binding to 192.168.1.11 as an example.
The network parameter file is located under / etc/network/ and execute the following command:
Suod gedit / etc/network/interfaces
Add the following
Auto lo iface lo inet loopback auto enp0s31f6 iface enp0s31f6 inet static address 192.168.1.11 gateway 192.168.1.1 netmask 255.255.255.0
The meaning of the parameter is as follows:
Enp0s316: name of your own network card, which can be checked through ifconfig
Address: the ip to be bound
Gateway and netmastk: check the computer's parameters for yourself.
*, we also need to make the configuration effective
/ etc/ini.d/network-manager restart ifdown enp0s31f6 ifup enp0s31f6 this is the end of the article on "how to deploy Samba to enable Linux and Windows to share files". Thank you for reading! I believe you all have a certain understanding of "how to deploy Samba to enable Linux and Windows to share files". If you want to learn more, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.