最近與室友之間頻繁傳文件,不喜飛鴿飛秋之類的,太麻煩,就整個samba服務器。
- [root@s1 ~]# groupadd -g 30000 room
- [root@s1 ~]# for user in sheng yan qin
- > do
- > useradd -G room -s /sbin/nologin $user
- > done
- #以上爲系統添加room組及無登錄權限之用戶
- [root@s1 ~]# for user in sheng yan qin
- > do
- > echo Adding $user to the smbpasswd file...
- > smbpasswd -a $user
- > done
- #以上添加smb用戶,其中smbpasswd -a 爲添加用戶,不加參數a則爲修改用戶
- [root@s1 ~]# mkdir -v /share
- [root@s1 ~]# chgrp room /share
- [root@s1 ~]# chmod 3775 /share
- 方法一:
- [root@s1 ~]# setsebool -P allow_smbd_anon_write on
- [root@s1 ~]# chcon -t public_content_rw_t /share
- 方法二:
- [root@s1 ~]# chcon -t samba_share_t /share
- [room]
- comment = share of 405
- path = /share
- write list = @room
- read only = yes
- public = no
- create mask = 0664
- #以上添加在/etc/samba/smb.conf末尾即可
- [root@s1 ~]# testparm
- Load smb config files from /etc/samba/smb.conf
- ...
- [root@s1 ~]# service smb restart
- smbclient -U yan //10.106.6.201/room
- #回車後輸入密碼即可