IT 운영

[SAMBA/CentOS7] SAMBA 환경 설정

leehi9817 2023. 4. 3. 14:03

SAMBA(Server Message Block)

서버 메시지 블록(Server Message Block, SMB)은 도스나 윈도우에서 파일이나 디렉터리 및 주변 장치들을 공유하는데 사용되는 메시지 형식입니다. NetBIOS는 SMB 형식에 기반을 두고 있으며, 많은 네트워크 제품들도 SMB를 사용합니다. 이러한 SMB 기반의 네트워크에는 랜매니저, 윈도우 포 워크그룹(Windows for Workgroups), 윈도우 NT, 그리고 랜 서버(Lan Server) 등이 있습니다. 서로 다른 운영 체제 사이에 파일을 공유할 수 있도록 하기 위해 SMB를 사용하는 제품들도 많이 있습니다. 그 중 하나가 삼바인데, 유닉스와 윈도우 컴퓨터들간에 디렉터리와 파일을 공유할 수 있게 합니다.

환경 설정

- 서버
# yum install -y samba
# mkdir -p /var/samba/share
# chmod 777 /var/samba/share
# adduser kosa
# passwd kosa
# smbpasswd -a kosa
# vi /etc/samba/smb.conf
[share]
        comment = Share Directory
        path = /var/samba/share
        browserable = yes
        writable = yes
        valid users = kosa
        create mask = 0777
        directory mask = 0777

# systemctl enable --now smb
# systemctl enable --now nmb
# systemctl restart smb
# systemctl restart nmb
# systemctl status smb nmb

# firewall-cmd --permanent --add-service=samba
# firewall-cmd --reload
# firewall-cmd --list-all

- 윈도우 클라이언트 접속 방법
\\10.26.0.100

- CentOS7 클라이언트 접속 방법
# yum install -y samba-client
# smbclient //10.26.0.100/share -U kosa

- Ubuntu 클라이언트 접속 방법
$ sudo apt install -y smbclient
$ smbclient //10.26.0.100/share -U kosa