為了方便部署後的應用升級,通過配置linux的samba實現windows共用linux的應用程式目錄,簡化和加快日後的應用升級和部署工作。
[root@tomcat ~]# uname -a
Linux tomcat 2.6.9-89.ELsmp #1 SMP Mon Jun 22 12:32:43 EDT 2009 i686 i686 i386 GNU/Linux
[root@tomcat ~]# cat /etc/issue
CentOS release 4.8 (Final)
Kernel \r on an \m
[root@tomcat ~]# rpm -qa | grep sam
samba-3.0.33-0.17.el4
samba-client-3.0.33-0.17.el4
system-config-samba-1.2.21-1.el4.1
samba-common-3.0.33-0.17.el4
[root@tomcat ~]# find / -name smb.conf
/etc/samba/smb.conf
我們要修改的設定檔就是/etc/samba/smb.conf,增加如下幾行:
[tomcat] ; 隨便起個你想要的名字
path = /opt/tomcat ; 共用的目錄
valid users = tomcat ; 共用登陸使用者
public = no ;
writable = yes ; 是否允許寫入
printable = no ;
create mask = 0765 ; 建立檔案目錄的預設許可權
www.2cto.com
設定完成後可以使用testparm進行設定檔的驗證
[root@tomcat ~]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[printers]"
Processing section "[tomcat]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
passdb backend = tdbsam
idmap uid = 16777216-33554431
idmap gid = 16777216-33554431
cups options = raw
。。。。。
。。。。。
設定訪問使用者和密碼
[root@tomcat ~]#smbpasswd tomcat
輸入你要設定的密碼即可,注意這個使用者密碼是在win訪問的時候使用的,使用者可以是已經存在的,像我這裡使用的就是應用的使用者。
關閉防火牆
[root@tomcat ~]# service iptables stop
禁用防火牆
[root@tomcat ~]# chkconfig iptables off
手工啟動SMB
[root@tomcat ~]# service smb start
啟動SMB 服務:
啟動NMB 服務:
配置SMB自啟動
[root@tomcat ~]# chkconfig smb on
OK,可以在win用戶端輸入\\ip進行訪問linux提供的共用目錄了。
-The End-
摘自 Gtlions