天天看點

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

           

繼續閱讀