標籤:mba home 屏蔽 val pass main 情況 添加 bad
user安全層級第一步:安裝samba3(如果已經安裝就跳過這一步)
[[email protected] /]# yum groupinstall "CIFS file server"
第二步:修改設定檔
[[email protected] /]# vi /etc/samba/smb.conf
將security參數的值設為user(這是預設值)
security = user
第三步:建立可以訪問共用目錄的使用者
[[email protected] test]# useradd tommy
第四步:修改使用者密碼(紅色的兩行是因為RedHat6對密碼的安全層級要求較高)
[[email protected] test]# passwd tommy
Changing password for user tommy.
New password:
BAD PASSWORD: it does not contain enough DIFFERENT characters
BAD PASSWORD: is a palindrome
Retype new password:
passwd: all authentication tokens updated successfully.
第五步:將tommy添加為samba使用者
[[email protected] test]# smbpasswd -a tommy
New SMB password:
Retype new SMB password:
Added user tommy.
第六步:修改設定檔/etc/samba/smb.conf,配置共用目錄
[sambashare_user]
comment = test resource
path = /sambashare_user
writable = yes
browseable = yes
write list = tommy
public = no
第七步:將使用者tommy的家目錄屏蔽起來
;[homes]
; comment = Home Directories
; browseable = no
; writable = yes
; valid users = %S
; valid users = MYDOMAIN\%S
預設情況下,[homes],browseable,writable參數前面是沒有分號的,這樣用戶端就能看到使用者tommy的家目錄,
這樣不安全,所以要在[homes],browseable,writable前面加上分號,這樣在用戶端就只能看見sambashare_user
這一個目錄了
第八步:建立共用目錄,並修改selinux的上下文許可權及目錄所有者
[[email protected] /]# mkdir sambashare_user
[[email protected] /]# chcon -t samba_share_t sambashare_user
[[email protected] /]# ls -adlZ sambashare_user
drwxr-xr-x. root root unconfined_u:object_r:samba_share_t:s0 sambashare_user
[[email protected] /]# chown tommy.root sambashare_user
[[email protected] /]# ls -adlZ sambashare_user
drwxr-xr-x. tommy root unconfined_u:object_r:samba_share_t:s0 sambashare_user
第九步:重啟samba服務
[[email protected] /]# service smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
第十步:在windows上面建立一個使用者tommy
第十一步: 在我的電腦中輸入\\192.168.1.120,鍵入斷行符號鍵
第十二步:雙擊共用目錄sambashare_user,輸入使用者名稱tommy及其密碼(這個使用者是windows上建立的使用者)
然後點擊【確定】按鈕
第十三步:在該檔案夾中,建立一個檔案test.txt
到此一個Linux下的基於user層級的共用目錄就共用完成了,在Windows下就可以訪問它了
Windows訪問Linux下的共用目錄的配置方法