Linux

[Linux] SAMBA

Richard.Ryu 2024. 3. 19. 14:03
반응형

SAMBA 는 SMB(Server Message Block)프로토콜로 작동하여

 

리눅스, 유닉스에서 Windows 와 파일 전송 프린터 공유 등의 서비스를 제공하는 패키지입니다.

#Redhat(centOS) release
yum update
yum -y install samba

#Debian(ubuntu) release
apt update
apt install samba
------------------------------------------------------------------------------------
samba.x86_64 0:4.10.16-25.el7_9

Dependency Installed:
  avahi-libs.x86_64 0:0.6.31-20.el7                 cups-libs.x86_64 1:1.6.3-52.el7_9            gnutls.x86_64 0:3.3.29-9.el7_6                    libldb.x86_64 0:1.5.4-2.el7
  libtalloc.x86_64 0:2.1.16-1.el7                   libtdb.x86_64 0:1.3.18-1.el7                 libtevent.x86_64 0:0.9.39-1.el7                   libwbclient.x86_64 0:4.10.16-25.el7_9
  nettle.x86_64 0:2.7.1-9.el7_9                     pyldb.x86_64 0:1.5.4-2.el7                   pytalloc.x86_64 0:2.1.16-1.el7                    python-tdb.x86_64 0:1.3.18-1.el7
  samba-client-libs.x86_64 0:4.10.16-25.el7_9       samba-common.noarch 0:4.10.16-25.el7_9       samba-common-libs.x86_64 0:4.10.16-25.el7_9       samba-common-tools.x86_64 0:4.10.16-25.el7_9
  samba-libs.x86_64 0:4.10.16-25.el7_9              trousers.x86_64 0:0.3.14-2.el7

Complete!
------------------------------------------------------------------------------------

 

1. Samba 접속 계정 설정 > smbpasswd 명령어 사용

[root@localhost home]# smbpasswd -a ryu
New SMB password:
Retype new SMB password:
Added user ryu.

#smb 등록 계정 확인
[root@localhost home]# smbpasswd -L 

#smb 계정 비밀번호 변경
[root@localhost home]# smbpasswd {계정}

#smb 등록 계정 삭제
[root@localhost home]# smbpasswd -x {계정}

#smb 등록된 계정 비활성화
[root@localhost home]# smbpasswd -d {계정}

 

 

 

2. 설정 파일 수정 > /etc/samba/smb.conf > 유저 및 권한 설정

[global]
        workgroup = SAMBA
        security = user
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw

[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = Yes
        read only = Yes
        inherit acls = Yes

[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = @printadmin root
        force group = @printadmin
        create mask = 0664
        directory mask = 0775

 

3. samba service 시작

[root@localhost samba]# systemctl start smb
[root@localhost samba]# systemctl status smb
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2024-03-19 00:35:04 EDT; 2s ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 75924 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 4
   Memory: 10.7M
   CGroup: /system.slice/smb.service
           ├─75924 /usr/sbin/smbd --foreground --no-process-group
           ├─75926 /usr/sbin/smbd --foreground --no-process-group
           ├─75927 /usr/sbin/smbd --foreground --no-process-group
           └─75928 /usr/sbin/smbd --foreground --no-process-group

Mar 19 00:35:04 localhost.localdomain systemd[1]: Starting Samba SMB Daemon...
Mar 19 00:35:04 localhost.localdomain smbd[75924]: [2024/03/19 00:35:04.530241,  0] ../../lib/util/become_daemon.c:136(daemon_ready)
Mar 19 00:35:04 localhost.localdomain smbd[75924]:   daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
Mar 19 00:35:04 localhost.localdomain systemd[1]: Started Samba SMB Daemon.

 

4. Local PC samba 접속 확인 > \\{접속할 서버 IP} > 등록한 계정 로그인 > 사용자 Home Directory 확인

 

반응형

'Linux' 카테고리의 다른 글

[Linux] Service Enabled/Disabled  (0) 2024.04.24
[Linux] Audit : backlog limit exceeded  (0) 2024.04.24
[Linux] tree  (0) 2024.03.19
[Linux] userdel  (0) 2024.03.11
[Linux] adduser & useradd  (0) 2024.03.08