搭建sam匿名共享服务器

本文档详细介绍了如何在服务端wangxiaolan (172.16.30.11)上通过yum命令安装并配置Samba服务器,创建共享目录cwl,并实现匿名访问。接着在客户端chenwanli (172.16.30.111)上查看服务器共享资源,挂载共享目录,并创建新文件进行验证。
服务端 wangxiaolan 172.16.30.11
客户端 chenwanli 172.16.30.111
//使用yum命令安装samba服务器:
[root@wangxiaolan ~]# yum -y install samba-*
//在全局配置中添加如下内容:
[root@wangxiaolan ~]# vim /etc/samba/smb.conf
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.

[global]
workgroup = SAMBA
security = user
map to guest = Bad User      //添加此行内容
//创建一个共享目录cwl
[root@wangxiaolan ~]# mkdir /opt/cwl
[root@wangxiaolan ~]# chmod 777 /opt/cwl/
[root@wangxiaolan ~]# ll /opt/
total 0
drwxrwxrwx. 3 root root 26 Aug  4 15:17 cwl
//配置共享
[root@wangxiaolan ~]# cat >> /etc/samba/smb.conf <<EOF
> [cwl]
> comment = cwl
> path = /opt/cwl
> browseable = yes
> guest ok = yes
> writable = yes
> public = yes
> EOF

[root@wangxiaolan ~]# tail -8 /etc/samba/smb.conf
[cwl]
comment = cwl
path = /opt/cwl
browseable = yes
guest ok = yes
writable = yes
public = yes
//启动smb服务:
[root@wangxiaolan ~]# systemctl start smb
[root@wangxiaolan ~]# smbclient -L 172.16.30.11 -U 'Bad User'
Enter Bad User's password: 
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]
//在客户机查看samba服务器有哪些共享资源
[root@chenwanli ~]# smbclient -L 172.16.12.128 -U 'Bad User'
Sharename       Type      Comment
---------       ----      -------
chen            Disk      chen
IPC$            IPC       IPC Service (Samba Server Version 4.1.1)
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

Server               Comment
---------            -------

Workgroup            Master
---------            -------
//将samba服务器的共享资源wangqing挂载到客户机本地
[root@chenwanli ~]# mount -t cifs //172.16.30.11/cwl /opt/smb/ -o username='Bad User'
[root@chenwanli ~]# df -h
文件系统               容量  已用  可用 已用% 挂载点
/dev/mapper/rhel-root   18G  3.1G   15G   18% /
devtmpfs               905M     0  905M    0% /dev
tmpfs                  914M  140K  914M    1% /dev/shm
tmpfs                  914M  8.9M  905M    1% /run
tmpfs                  914M     0  914M    0% /sys/fs/cgroup
/dev/sda1              497M  119M  379M   24% /boot
//172.16.16.30/cwl    18G  3.1G   15G      18% /opt/smb
//在客户机上进入共享目录创建新文件
[root@chenwanli smb]# ls
[root@chenwanli smb]# touch slm
[root@chenwanli smb]# mkdir aaaa
[root@chenwanli smb]# ls
slm aaaa
/到服务器上验证
[root@wangxiaolan ~]# cd /opt/cwl/
[root@wangxiaolan cwl]# ls
slm  aaaa
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值