天天看点

samba搭建匿名用户共享服务器samba

samba

文章目录

  • samba
    • 1.搭建匿名用户共享服务器

1.搭建匿名用户共享服务器

1.环境
ip 主机 环境
172.16.30.30 system2 redhat7图形界面
172.16.30.130 system1 redhat7图形界面
2.环境准备
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# setenforce 0
           
3.服务端
[[email protected] Desktop]# yum -y install samba-*
[[email protected] Desktop]# systemctl start smb
[[email protected] Desktop]# systemctl enable smb
ln -s '/usr/lib/systemd/system/smb.service' '/etc/systemd/system/multi-user.target.wants/smb.service'
[[email protected] Desktop]# mkdir -p /opt/jianghu
[[email protected] Desktop]# chmod 777 /opt/jianghu/
[[email protected] Desktop]# ll /opt/
total 0
drwxrwxrwx. 2 root root 6 Jan 14 16:33 jianghu
drwxr-xr-x. 2 root root 6 Jan 27  2014 rh
[[email protected] Desktop]# vim /etc/samba/smb.conf 
[[email protected] Desktop]# cd
[[email protected] ~]# cat >> /etc/samba/smb.conf <<EOF
> [jianghu]
> comment = jianghu
> path = /opt/jianghu
> browseable = yes
> guest ok = yes
> writable = yes
> public = yes
> EOF
[[email protected] ~]# tail -7 /etc/samba/smb.conf 
[jianghu]
comment = jianghu
path = /opt/jianghu
browseable = yes
guest ok = yes
writable = yes
public = yes
[[email protected] ~]# systemctl restart smb.service 

           
4.客户端验证
[[email protected] ~]# smbclient -L 172.16.30.30 -U 'Bad User'
Enter Bad User's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]
  	Sharename       Type      Comment
  	jianghu         Disk      jianghu
	IPC$            IPC       IPC Service (Samba Server Version 4.1.1)
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]
	Server               Comment
	Workgroup            Master
           
挂载
[[email protected] ~]# mkdir -p /opt/smb
[[email protected] ~]# mount -t cifs //172.16.30.30/jianghu /opt/smb/ -o username='Bad User'
[[email protected] ~]# df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   4.9G  3.0G  2.0G  60% /
devtmpfs                985M     0  985M   0% /dev
tmpfs                   994M  140K  994M   1% /dev/shm
tmpfs                   994M  8.9M  986M   1% /run
tmpfs                   994M     0  994M   0% /sys/fs/cgroup
/dev/sda1               197M  104M   94M  53% /boot
/dev/sr0                3.5G  3.5G     0 100% /run/media/root/RHEL-7.0 Server.x86_64
//172.16.30.30/jianghu  4.9G  3.0G  2.0G  61% /opt/smb
           
在客户端上创建共享目录,文件
[[email protected] ~]# cd /opt/smb/
[[email protected] smb]# ls
[[email protected] smb]# touch wuzhiyong
[[email protected] smb]# mkdir zhangguang
[[email protected] smb]# ls
wuzhiyong  zhangguang

           

继续阅读