Anonymous access to Samba on Linux

One: the instructions used

1:检查是否安装samba了服务
rpm  -qa |grep samba
2:安装samba服务
mkdir  /iso  建立子目录
mount   /dev/cdrom    /iso  挂载光盘
vim   /etc/yum.repos.d/dvd.repo  配置yum源

[dvd]
name=dvd
baseurl=file:///iso
gpgcheck=0
enabled=1


yum info samba   査看Samba安装文件
yum clean all         清除缓存
yum  install samba-client -y   安装客户端
yum install  cifs-utils  -y
//设置状态
setenforce  0
//匿名方式进行访问
smbclient   -L  192.168.1.99  
//访问的具体路径
smbclient   //192.168.1.99/public    
ls  进行查看

Two: detailed steps

1: enable the client to ping the server

①: Set customer terminal and the server IP
click shut symbols> Click finite set
Insert picture description here
click set the symbol set, set the parameters as follows
Insert picture description here
Samba server
Insert picture description here
after restart the provided click Open
Insert picture description here

Samba client
Insert picture description here
set up after clicking the button restart the punch
Insert picture description here
②: Set customer end and server network adapters
Note: customer end and server should be set]
VM> click Settings
Insert picture description here
Network Adapter> Select VMnet1 (Host mode only)
Insert picture description here
③: Ping the server in the customer service side
[Note: Press Ctrl + z to stop]

ping 192.168.1.99

Insert picture description here

2: The client and server Samba let the firewall pass

[Note: Both the client and server must be closed]
①: Use the graphical interface to close
Insert picture description here
Enter the administrator password
Insert picture description here
Insert picture description here
②: Use the command mode

firewall-cmd  --permanent  --add-service=samba

Insert picture description here

refresh

firewall-cmd --reload

Insert picture description here

3: Install Samba service on the server

Installation tutorial, click to jump

4: Install Samba service on the client side

The previous steps are basically the same as the server. The instructions are as follows

1:检查是否安装samba了服务
rpm  -qa |grep samba
2:安装samba服务
mkdir  /iso  建立子目录
mount   /dev/cdrom    /iso  挂载光盘
vim   /etc/yum.repos.d/dvd.repo  配置yum源

[dvd]
name=dvd
baseurl=file:///iso
gpgcheck=0
enabled=1


yum info samba   査看Samba安装文件
yum clean all         清除缓存

Note that this is different, install the customer service!

//安装客服端
yum  install samba-client -y    
yum install  cifs-utils  -y

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

5: Create a shared file on the server

Linux commands used

//创建共享文件夹
mkdir  /share    
cd   /share
//创建文件
 echo  my name is xxx >file.txt
//查看文件
cat  file.txt

Insert picture description here

6: The server sets the attributes of the shared file

①: Enter into smb.conf

vim  /etc/samba/smb.conf

Insert picture description here

②: Add the attribute map to guest = bad user.
In the passdb backend… press Tab to jump to the header part of the corresponding column
[Note: Insert mode: insert]

//无需输入密码
 map to guest=bad  user

Insert picture description here

③: Add [public] shared file attribute

//只读属性共享
[public]
        comment=public
        path=/share
        browseable=yes
        read=yes
        public=yes

Insert picture description here
④: Save and exit Save and exit
in bottom line mode
【Note: Press Esc to enter bottom line mode】

:wq!

Insert picture description here

⑤: Restart the samba service

//重启samba服务
systemctl restart  smb

⑥: set enforce to 0

//设置一下
setenforce  0

//查看状态
getenforce

Before setting
Insert picture description here
set
Insert picture description here
after set
Insert picture description here

7: Server access

①: Anonymous access (Anonymous mode does not need to enter a password, just press Enter)
[Note: But has not yet entered the server for access]

//192.168.1.99 这个是服务端ip
smbclient   -L  192.168.1.99 

Insert picture description here
②: Access shared resources on the server side (no need to enter a password in the anonymous mode, just press Enter)
[Note: enter the server side at this time]

smbclient   //192.168.1.99/public 

Insert picture description here

Now that we have come in, enter the ls command to view (at this time we can see the shared file file.txt we created)

ls

Insert picture description here

Published 63 original articles · Like 23 · Visitors 6661

Guess you like

Origin blog.csdn.net/weixin_42753193/article/details/105490947