Linux SAMBA Practical
Samba配置 on Ap1-10.*.16.81
首先,判斷samba服務是否安裝?
[root@ap01 ~]# rpm -qa|grep samba
samba-client-3.5.10-125.el6.x86_64
samba-winbind-3.5.10-125.el6.x86_64
samba-winbind-clients-3.5.10-125.el6.x86_64
samba-common-3.5.10-125.el6.x86_64
samba-3.5.10-125.el6.x86_64
若出現如上信息,則證明已安裝;若執行grep后,空白無顯示内容,則沒有安裝samba包;
[root@ap01 ~]# yum -y install samba* //yum安裝samba(yum配置請參考其他文檔)
將samba服務開機自動啟動:
#chkconfig --level 35 smb on
第二,修改smb.conf 配置文件(/etc/samba/smb.conf)
2.1. 備份smb.conf文件:[root@ap01 samba]#cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
2.2. 編輯smb.conf文件:[root@ap01 samba]#vi smb.conf
//這裡僅修改======Share Difinitions======下面的[public] 内容,其他詳細配置請參考附上鏈接
http://www.cnblogs.com/mchina/archive/2012/12/18/2816717.html(shared link)
# A publicly accessible directory, but read only, except for people in
# the "staff" group
[public]
comment = Public Staff
path = /public
public = yes
writable = yes
guest ok = Yes
; printable = no
; write list = +staff
第三,在/根目錄下創建/public目錄并賦予nobody訪問權限
3.1.[root@ap01 ~]#mkdir -p /public
3.2.[root@ap01 public ]#touch 1.txt
3.3.[root@ap01 public ]#touch ok.txt
3.4.[root@ap01 / ]#chown -R nobody:nobody public/
3.5.[root@ap01 public]# ll
total 188
-rw-r--r--. 1 nobody nobody 0 Aug 1 17:47 1.txt
-rw-r--r--. 1 nobody nobody 0 Aug 2 08:29 ok.txt
-rw-r--r--. 1 nobody nobody 189870 Aug 2 10:14 server.jar
-rw-r--r--. 1 nobody nobody 0 Aug 1 17:47 smb.txt
第四.重啟smb
[root@ap01 public]# /etc/init.d/smb restart
第五.測試smb配置是否正確
[root@ap01 public]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[public]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[public]
comment = Public Shared
path = /public
read only = No
guest ok = Yes
第六.在Linux下访问Samba服务器的共享文件
6.1.修改samba root帳號密碼:#smbpasswd root
*******
*******
6.2. Linux 客戶端訪問操作(AP2-10.*.16.82)
[root@ap2 ~]# smbclient //10.*.16.81/public -U root
Enter root‘s password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]
smb: \> ls
. D 0 Sat Aug 2 10:18:56 2014
.. DR 0 Fri Aug 1 17:44:43 2014
smb.txt 0 Fri Aug 1 17:47:19 2014
server.jar 189870 Sat Aug 2 10:14:11 2014
1.txt 0 Fri Aug 1 17:47:14 2014
ok.txt 0 Sat Aug 2 08:29:13 2014
64507 blocks of size 131072. 58125 blocks available
smb: \>
6.3.將samba 之/public目錄mount至AP2-10.*.16.82
6.3.1. 在AP2-10.*.16.82 /根目錄下創建/public目錄
6.3.2. [root@ap2 ~]# mount -t cifs -l //10.*.16.81/public /public
6.3.3. df查看mount是否成功
//10.*.16.81/public
7.9G 389M 7.1G 6% /public
6.3.4. 將mount加入永久啟動
[root@ap2 ~]# vi /etc/rc.d/rc.local
mount -t cifs //10.*.16.81/public -o username=root,password=123foxconn$ /public
以上供參考!
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。