CentOS配置SAMBA實現windows共用linux檔案

來源:互聯網
上載者:User

 

為了方便部署後的應用升級,通過配置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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.