2014년 4월 30일 수요일

[Linux] CentOS 6.5 - Samba Server Configuration

* Samba는 주로 윈도우즈 사용자와 함께 파일서버 형태로 구성하는 경우 많이 사용을 하게 된다. 팀내 공유문서 및 파일 구성을 위해서 7년만에 CentOS를 접하면서 새로 설정 하는 것들을 찾다가 이것 저것 함께 정리 하게 되었다.

원문주소
" Easy Samba server installation on CentOS 6.5 " 

Samba is a client/server system that implements network resource sharing for Linux and other UNIX computers. With Samba, UNIX files and printers can be shared with Windows clients and vice versa. Samba supports the Session Message Block (SMB) protocol. Nearly all Windows computers include SMB support with their internal network subsystems (NetBIOS in particular).

With an appropriately-configured Samba server on Linux, Windows clients can map drives to the Linux filesystems. Likewise, the Samba client on UNIX can connect to Windows shares by their UNC name. Although differences among various operating systems (such as filesystem naming conventions, end-of-line conventions, and authentication) can limit interoperability, Samba offers a generally serviceable mechanism for resource sharing on a heterogenous network.


* 설치를 위해서 체크 및 버전을 확인 한다.

1. [root@orabackup ~]# yum install samba samba-client samba-common

2. [root@orabackup ~]# smbd --version



* 서비스를 자동으로 올려주기 위해서 아래의 문장을 처리 한다. 그러나 보통 한글판 CentOS6.5 버전을 설치 할때 보통의 특별한 체크를 하지 않았다면 "Basic Server" 버전 이상의 설치 체크에선 이미 등록되어 있다. 다만 자동 시작의 레벨 체크가 되어 있지 않으므로 그부분에 대한 설정 변경만 한다면 자동 실행을 큰 무리 없을 것이다.

여하튼 그것이 있든 없든 사용할 수 있는 구문 임

1. [root@orabackup ~]# chkconfig smb on
2. [root@orabackup ~]# chkconfig nmb on


* 방화벽 설정이 보통은 열려 있지 않으므로 방화벽 설정

1. [root@orabackup ~]# iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
2. [root@orabackup ~]# iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
3. [root@orabackup ~]# iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
4. [root@orabackup ~]# service iptables save

또는 설정파일을 직접 열어서 VI로 수정하여 서비스를 재시작 하여도 동일한 결과를 얻을 수 있다.



1. [root@orabackup ~]# vi /etc/sysconfig/iptables

* 아래내용 추가
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT

2. [root@orabackup ~]# service iptables restart


3. [root@orabackup ~]# cat /etc/sysconfig/iptables



* 윈도우에서 네트워크 드라이브로 접속(인증)할 사용자/그룹 정보와 폴더를 생성한다.

1. [root@orabackup ~]# useradd its
2. [root@orabackup ~]# groupadd smbgrp
3. [root@orabackup ~]# usermod -a -G smbgrp its
4. [root@orabackup ~]# smbpasswd -a its
5. [root@orabackup ~]# cd /home/its
6. [root@orabackup ~]# mkdir its_files
7. [root@orabackup ~]# chown -R its:smbgrp its_files/
8. [root@orabackup ~]# chmod -R 0770 its_files/


* Samba 설정 파일을 아래와 같이 변경하여 마무리 한다.



* 마무리한 서비스를 재시작 한다.

1. [root@orabackup ~]# service smb restart
2. [root@orabackup ~]# service nmb restart


* 네트워크 드라이브 연결은 윈도우에 처리 하며 별도의 설명을 붙이지 않겠음

1. \\서버해당아이피\its_files
2. 상위에서 만든 아이디/패스워드로 접속하여 연결 완료



댓글 없음:

댓글 쓰기

언제 부터 였던가 생각해보니 아르바이트 겸 외부 컨설팅을 의뢰 받고 맥북 프로를 처음 써봤을 때 부터 였던 것 같다. 지금은 거의 대부분의 작업을 맥으로 작업을 하다 보니 윈도우에서만 실행되는 일부 프로그램들 때문과 회사 내부 ERP프로그램이 윈도우 ...