真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

samba

####samba#########

成都創(chuàng)新互聯(lián)公司是專業(yè)的樂都網(wǎng)站建設(shè)公司,樂都接單;提供成都做網(wǎng)站、網(wǎng)站建設(shè),網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進行樂都網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!

1samba作用

提供cifs協(xié)議實現(xiàn)共享文件

 

2安裝

yum install samba samba-common samba-client -y

systemctl start smb nmb

systemctl enable smb nmb

systemctl stop firewalld.service

 

3添加smb用戶

smb用戶必須是本地用戶

smbpasswd -a student

New SMB password:                   #輸入smb當(dāng)前用戶密碼

Retype new SMB password:#確認密碼

Added user student.

 

pdbedit -L#查看smb用戶信息

student:1000:Student User  

 

pdbedit -x student#刪除smb用戶

 

setsebool -P samba_enable_home_dirs on  ##在selinux中設(shè)定smb用戶可以訪問自己的家目錄

 

4共享目錄的基本設(shè)定

117

mkdir /smbshare

touch /smbshare/123

 

vim /etc/samba/smb.conf

321         [westos]      ##共享名稱

322         comment = local directory   ##對共享目錄的描述

323         path = /smbshare     ##共享目錄的絕對路徑

 

當(dāng)共享目錄為用戶自建目錄時

semanage fcontext -a -t samba_share_t '/smbshare(/.*)?'

restorecon -Rvvf /smbshare/

systemctl restart smb.service

 

測試

17

[root@DNS-server 桌面]# smbclient //172.25.254.117/westos -U student

Enter student's password:

Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

smb: \> ls

  .                                   D        0  Sat Jun  3 14:39:20 2017

  ..                                  D        0  Sat Jun  3 14:39:12 2017

  123                                 N        0  Sat Jun  3 14:39:20 2017

 

10473900 blocks of size 1024. 7316272 blocks available

smb: \> SMBecho failed (NT_STATUS_CONNECTION_DISCONNECTED). The connection is disconnected now

 

當(dāng)共享目錄為系統(tǒng)建立目錄

setsebool -P samba_export_all_ro on#只讀共享

setsebool -P samba_export_all_rw on#讀寫共享

systemctl restart smb.service

 

測試

17

[root@dns-server 桌面]# smbclient //172.25.254.117/westos -U student

Enter student's password:

Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

smb: \> ls

  .                                   D        0  Sat Jun  3 13:54:54 2017

  ..                                  D        0  Sat Jun  3 14:39:12 2017

  fstab                               N      313  Wed May  7 09:22:57 2014

  crypttab                            N        0  Wed May  7 09:22:57 2014

  mtab                                R        0  Sat Jun  3 14:47:19 2017

  pki                                 D        0  Wed May  7 09:27:13 2014

  rpm                                 D        0  Fri Jul 11 06:36:36 2014

  yum                                 D        0  Wed May  7 09:24:49 2014

  issue                               N       23  Tue Apr  1 21:28:10 2014

  binfmt.d                            D        0  Wed Apr  2 21:30:23 2014

  issue.net                           N       22  Tue Apr  1 21:28:10 2014

  modules-load.d                      D        0  Wed Apr  2 21:30:23 2014

  os-release                          N      493  Tue Apr  1 21:28:10 2014

  fonts                               D        0  Fri Jul 11 06:22:37 2014

  redhat-release                      N       52  Tue Apr  1 21:28:10 2014

  DIR_COLORS.256color                 N     5725  Sat Jan 25 03:23:50 2014

    。。。。。。。

 

5samba的配置參數(shù)

   

#匿名用戶訪問

vim /etc/samba/smb.conf

125         map to guest = bad user

324guest ok = yes

 

測試

17

[root@dns-server 桌面]# smbclient //172.25.254.117/westos

Enter kiosk's password:      ###無密碼

Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

smb: \> ls

  .                                   D        0  Sat Jun  3 14:39:20 2017

  ..                                  D        0  Sat Jun  3 14:39:12 2017

  123                                 N        0  Sat Jun  3 14:39:20 2017

 

10473900 blocks of size 1024. 7305320 blocks available

 

 

 

#訪問控制

hosts allow =  ##僅允許

hosts deny =  ##僅拒絕

valid users =#當(dāng)前共享的有效用戶

valid users = westos#當(dāng)前共享的有效用戶為westos

valid users = @westos#當(dāng)前共享的有效用戶為westos組

valid users = +westos#當(dāng)前共享的有效用戶為westos組

測試

117

vim /etc/samba/smb.conf

325         hosts allow = 172.25.254.17

 

17

[root@dns-server 桌面]# smbclient //172.25.254.117/westos

Enter kiosk's password:

Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

smb: \> ls

  .                                   D        0  Sat Jun  3 14:39:20 2017

  ..                                  D        0  Sat Jun  3 14:39:12 2017

  123                                 N        0  Sat Jun  3 14:39:20 2017

 

10473900 blocks of size 1024. 7305276 blocks available

217

[root@localhost ~]# smbclient //172.25.254.117/westos

Enter root's password:

Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

tree connect failed: NT_STATUS_ACCESS_DENIED

 

測試

117

vim /etc/samba/smb.conf

324         valid users = westos

 

17

[root@dns-server 桌面]# useradd westos -s /sbin/nologin

[root@dns-server 桌面]# smbpasswd -a westos

New SMB password:

Retype new SMB password:

Added user westos.

[root@dns-server 桌面]# smbclient //172.25.254.117/westos -U westos

Enter westos's password:

Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.1]

smb: \>

 

 

##讀寫控制

所有用戶均可寫

chmod o+w /smbshare   ##修改共享目錄權(quán)限

setsebool -P samba_export_all_rw on

vim /etc/samba/smb.conf

324         writable = yes

systemctl restart smb.service

 

測試

17

[root@dns-server 桌面]# mount -o username=westos,password=redhat //172.25.254.117/westos /mnt/

[root@dns-server 桌面]# cd /mnt/

[root@dns-server mnt]# ls

123

[root@dns-server mnt]# touch file3

[root@dns-server mnt]# ls

123  file3

 

 

 

設(shè)定指定用戶可寫

write list = student    #可寫用戶

write list = +student#可寫用戶組

write list = @stident

admin users = westos#共享的超級用戶指定

 

測試

117

vim /etc/samba/smb.conf

324         writable = no

325         write list = student

 

 

217

smbpasswd -a student

useradd westos

usermod -G westos student

mount -o username=student,password=123 //172.25.254.117/westos /mnt/

[root@localhost mnt]# ls

123  1234fref  file3

[root@localhost mnt]# touch file5

[root@localhost mnt]# ls

123  1234fref  file3  file5

 

測試

117

vim /etc/samba/smb.conf

324         writable = yes

325         admin users = westos

 

217

[root@localhost ~]# mount -o username=westos,password=redhat //172.25.254.117/westos /mnt/

[root@localhost ~]# cd /mnt/

[root@localhost mnt]# ls

123  1234fref  file3  file5

[root@localhost mnt]# touch file6

[root@localhost mnt]# ls -l file6

-rw-r--r--. 1 root westos 0 6月   3 04:36 file6

 

 

6smb多用戶掛載

在client(客戶端)上

 

vim /root/haha

username=student

password=123     ##密碼為smb密碼

 

chmod 600 /root/haha

 

yum install cifs-utils.x86_64  -y

 

mount -o credentials=/root/haha,multiuser,sec=ntlmssp //172.25.254.117/westos /mnt/

 

#credentials=/root/haha  指定掛載時所用到的用戶文件

#multiuser        支持多用戶認證

#sec=ntlmssp認證方式為標(biāo)準(zhǔn)smb認證方式

 

 

 

 

[root@localhost ~]# su - westos

[westos@localhost ~]$ ls /mnt

ls: cannot access /mnt: Permission denied   #因為沒有作smb的認證所以無法訪問smb的共享

[westos@localhost ~]$ cifscreds add -u westos 172.25.254.117

Password:##smb用戶westos的密碼

[westos@localhost ~]$ ls /mnt

123  1234fref  file3  file5  file6

[westos@localhost ~]$


網(wǎng)頁標(biāo)題:samba
當(dāng)前路徑:http://weahome.cn/article/gjhdjs.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部