搭建sam匿名共享伺服器

2021-09-09 06:39:43 字數 2876 閱讀 7624

服務端 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 <[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  /opt/smb/ -o username='bad user'

[root@chenwanli ~]# df -h

檔案系統 容量 已用 可用 已用% 掛載點

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

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

檔案共享伺服器

1 cifs協議的檔案共享伺服器 ms開發的,而ftp是全球通用的 2 建立共享 方法 資料夾右鍵屬性 共享 開啟共享 設定共享名 設定共享許可權 3 a使用者遠端登入訪問共享資料夾的時候,a使用者的許可權受到安全和共享這兩個許可權的控制,是兩者的交集 4 保證某個資料夾共享 共享 許可權 在此資料...

檔案共享伺服器

6.關閉檔案共享服務 445埠 注 1 在本地登入時,只受ntfs許可權的影響 2 在遠端登入時,將受共享及ntfs許可權的共同影響,且取交集!3 所以建議設定共享許可權為everyone完全控制,然後具體的許可權需求在ntfs許可權中設定即可 通過命令列或者檔案路徑輸入 ip位址即可,然後填寫使用...

檔案共享伺服器

方法 資料夾屬性 共享 開啟共享 設定共享名 設定共享許可權 注 1 在本地登陸時,只受ntfs許可權的影響,2 在遠端登陸時,將受共享及ntfs許可權共同影響,且取交集!3 所以建議設定共享許可權為everyone完全控制,然後具體的許可權需求在ntfs許可權中設定即可。在開始執行 或我的電腦位址...