[root@server7 ~]# vi /etc/samba/smb.conf 삼바서버의 설정파일
# workgroup = NT-Domain-Name or Workgroup-Name # workgroup = MYGROUP workgroup = linux6 #공유그룹 명칭 리눅스6으로했다. Xwindow나 윈도우에서 네트워크 공유를 찾을때 공유그룹이 이거다 ^^
# server string is the equivalent of the NT Description field server string = Server7 Samba Server #그냥 삼바서버 설명
# Security mode. Most people will want user level security. See # security_level.txt for details. security = share<------------ 중요부분 그냥 공유로되어있다. #user : 기본보안 정책으로 사용자인증을 삼바서버를 통해서 인증한다 마치 아파치의 .htaccess 처럼 #share : 아무나 들어오게해준다. #server :기본 적으로 user와 비슷하나 사용자의 인증을 samba프로토콜을지원하는 다른 인증서버에서한다 #domain : 사용자계정 인증을 윈도우NT 도메인에서 처리하는 방식이다.
# Use password server option only with security = server ; password server = <NT-Server-Name> #위에 security 를 서버나 도메인으로 할경우 위에 인증할서버의 DPC의 netBIOS 를 적어준다.
# Password Level allows matching of _n_ characters of the password for # all combinations of upper and lower case. ; password level = 8 ; username level = 8 #유저이름과 패스 글자수
# You may wish to use password encryption. Please read # ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation. # Do not enable this option unless you have read those documents ; encrypt passwords = yes ; smb passwd file = /etc/samba/smbpasswd #삼바서버 사용자 패스워드 암호화및 암호파일 경로
# The following are needed to allow password changing from Windows to # update the Linux system password also. # NOTE: Use these with 'encrypt passwords' and 'smb passwd file' above. # NOTE2: You do NOT need these to allow workstations to change only # the encrypted SMB passwords. They allow the Unix password # to be kept in sync with the SMB password. ; unix password sync = Yes ; passwd program = /usr/bin/passwd %u ;
passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n
*passwd:*all*authentication*tokens*updated*successfully* #클라이언트에서 서버의 삼바사용자 패스워드를 변경할수있도록 설정하는부분
맨아래 부분에 share를 위한 디렉토리 설정이있다
[Server7's Samba] #폴더 이름 comment = Server7's SambaDir #마우스를 올려놓으면 뜨는이름 path = /smb #실제 시스템에 공유해줄 디렉토리 public = yes writable = yes printable = no create mask = 0765
설정파일이 제대로 됫는지 구문을 확인하는방법은 testparm 이라고 치면 /etc/samba/smb.conf 파일을 체크한다. syntax에러가 없는지 -0-
share 일경우 위에같이 하고 설정후 service smb start 누군가 내 컴퓨터에 10.10.64.7 로 접속하면 공유폴더 하나가뜰껏이다.
# Security mode. Most people will want user level security. See # security_level.txt for details. security = user #이부분을 user로 바꾸고 나온다
그외 아래 주석되어있는것들은 안해도 기본적으로되는가보다. - - passwd파일의 경로나 암호화하겠다는설정이나 그런것들 --
service smb restart하고 계정을 만들어주는데 주의할점은 localsystem 에 존재하는 계정이름이여야된다.
[root@server7 smb]# smbpasswd -a test1 New SMB password: Retype new SMB password: Added user test1. 테스트1 추가
[root@server7 smb]# smbpasswd -a test2 New SMB password: Retype new SMB password: Failed to initialise SAM_ACCOUNT for user test2. Does this user exist in the UNIX password database ? Failed to modify password entry for user test2 [root@server7 smb]# 로칼에 그 계정이 없으면 저렇게 페일이 떨어진다. 계정추가후다시
[root@server7 smb]# smbpasswd -a test2 New SMB password: Retype new SMB password: Added user test2. [root@server7 smb]# cat /etc/samba/smbpasswd nobody:99:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DU ]:LCT-00000000: test1:500:E88D94D6EBD10FC7AAD3B435B51404EE:AACD12D27C87CAC8FC0B8538AED6F058:[U ]:LCT-489121D2: test2:501:E3FDADCB358C2967AAD3B435B51404EE:0E8231621F574D3636255FF36DD86C9C:[U ]:LCT-48912245:
이제 클라이언트에서 접속을 하면 user모드이무로 아이디와 패스를 물어본다.
그리고 설정을 보면 여기아래 [homes]라고 있는데 사용자 계정 홈디렉토리가 자기자신에게 공유가 된다. 아깐 share모드라 안됫는데 user모드라 되는가보다. 주석처리하면안되겟지 ^^
[homes] comment = Home Directories browseable = no writable = yes
[Server7's Samba2] comment = Server7's SambaDir path = /smb2 public = yes writable = yes printable = no valid users = test2 #테스트 2만 들어갈수있는 공유폴더를 하나만들었다.
testparm 으로 에러체크하고 -0-
service smb restart 하고 하면 이제 부터 비번을 쳐서 나의 삼바에 접속해야되고 test1은 자신의 공유폴더하나와 Server7's Samba, Server7's Samba2 이렇게 3개가 다 보인다. 하지만 test1사용자는 Server7's Samba2에는 아예들어갈수가없다. test2 tes1과 같이다 보이고 Samba2에도 들어갈수있다.
공유할때 쓴는 옵션들 comment : 공유디렉토리마우스를 올려놓으면 뜨는 이름 browseable : 공유폴더그림을 브라우저에 표시할것인지를 지정 writable : 접속하는 사용자에게 쓰기를 허용한다 create mask : 쓰기 퍼미션을 설정 숫자로 쓴다. invalid users : 사용불가능한 유저를 지정 valid users : 사용가능한 유저를 지정 path : 공유할 디렉토리 지정 public : 누구나 접근 가능 여부를 지정 printable : 프린터 공유 디렉토리일때 설정한다. guest ok : guest 접근 가능 여부를 지정하낟. write list : 쓰기가능한 자또는 그룹을 지정 그룹자는 앞에 @를 붙인다 read only : 읽기만 가능하게 디렉토리를 지정
Sharename Type Comment --------- ---- ------- public Disk insa Disk smb2 edu Disk IPC$ IPC IPC Service (Samba Server) printer1 Printer printer Printer printer Anonymous login successful Domain=[LINUX6] OS=[Unix] Server=[Samba 3.0.24-7.fc5]
Server Comment --------- ------- SERVER100 server100 Samba Server SERVER8 Samba Server
공유 /public 누구나 접속가능하게, alba만 쓰기가능 /insa test1 test2 sajang 만 접속가능 쓰기가능 /edu test3 test4 test5 sajang 만 접속 가능하고 쓰기가능 /sec sajang만 접속 및 쓰기가능 누구에게도 보이지안게 설정
[public] comment = Server7's Public SambaDir path = /public public = yes writable = no write list = alba create mask = 0765 #public yes로 보이고 들어올수있으나 writalbe no 로 글쓰기가안된다 #alba만 글쓰기 리스트에 합류 글쓰기가 가능
그리고 웹에서 SAMBA관리할려면 SWAT 이라는 패키지를 이용한다 xinetd 방식으로 이용되므로 xinetd가 필요하다
암튼 swat을 성공적으로 깔고
[root@server7 var]# vi /etc/xinetd.d/swat # default: off # description: SWAT is the Samba Web Admin Tool. Use swat \ # to configure your Samba server. To use SWAT, \ # connect to port 901 with your favorite web browser. service swat { port = 901 socket_type = stream wait = no only_from = www.server7.co.kr <-- 접속될 주소 user = root server = /usr/sbin/swat log_on_failure += USERID disable = no <--- 서비스 하게끔 no로 설정 }
service xinetd start 해주고 http://www.server7.co.kr:901/ 하면 들어간다