LINUX system centos8 build samba server

Experimental manual:

Samba is a free software that implements the SMB protocol on Linux and UNIX systems , and consists of server and client programs. The SMB (Server Block the Messages, information service block) in a local area network to share files and a printer on the communication protocol provides shared service resource files and printers among different computers within the LAN is. The SMB protocol is a client/server protocol through which the client can access the shared file system, printers and other resources on the server. By setting "NetBIOS over TCP/IP", Samba can not only share resources with hosts on the local area network, but also share resources with computers all over the world.

Experimental tutorial:

01 install samba service

Install and download samba:

rpm -q samba //检测samba是否存在;
yum install samba -y  //通过yum源下载服务.

02 Configure the samba file: (You can choose the graphical interface configuration or use the vim editor)

Guoguo first introduces the graphical interface configuration

#1 Find the samba configuration file (root/etc/samba/smb.conf) and double-click to open it.

Then delete the configuration content inside and enter the following configuration content:

[global]
security=user
workgroup =smb
map to guest =bad user
[tupian]
path=/tupian
browsable=yes
writable=yes
guest ok =yes

Command line configuration method:

vim /etc/samba/smb.conf //使用vim配置smb.con文件.
输入以下内容:
[global]
security=user
workgroup =smb
map to guest =bad user
[tupian]
path=/tupian
browsable=yes
writable=yes
guest ok =yes
完成配置:esc+冒号+wq保存退出。

Save and complete the configuration.

03 access samba server

win+x, enter the operating environment, enter the samba server \\+ip.

There is a problem to note here, we need to turn off the firewall of the linux server so that we can access the folder of the samba server.

systemctl stop firewalld.service //关闭防火墙

 

Experimental upgrade

Add user authentication access, realize file sharing, and set user access.

useradd user01 //添加用户user01;
smbpasswd -a user01 //把user01用户转化为samba用户;
123456
123456 //输入两次密码。

 

Enter /root/etc/samba/smb.conf/ to configure the samba content.

[global]
security=user //表示安全级别
workgroup = smb //表示工作组
[home] //共享文件的名称
path=/home //文件路径
valid users=user01 //用户
valid users=user02
browsable=yes //表示是否允许浏览器访问
public=yes //是否为公共
guest ok=no //是否允许匿名身份登录
writable=yes //是否可以写入

Configure the permissions of the shared directory:

chome 777 /root/home/ //给予权限

During operation, access the samba service. Enter the user name to log in. (User name here: user01 password: 123456)

Here we can access our shared file home:

get small knowledge: enter cmd command input

C:\>net use * /del /y 

Disconnect all shared connections with the samba service.

Remember, you must give shared file permissions. Otherwise it is inaccessible.

Guess you like

Origin blog.csdn.net/qq_43575090/article/details/106936623