linux

Centos -samba

sysman 2020. 12. 27. 07:00

 아래와 같은 에러가 나온다면 CIFS 관련 유틸이 설치되지 않은 것

에러) 

mount: wrong fs type, bad option, bad superblock on //192.168.1.2/test,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
      
      

 

 

============================================================

윈도우 폴더 가져다 리눅스에 share해서 쓰기

 

 

윈도우에서 계정생성

cmd 관리자 권한으로 실행

 > net user root 1234 /add

 

폴더 세팅

 

<linux server>

[root@server1 ~]# rpm -qa | grep samba
[root@server1 ~]# dnf -y install samba*

[root@server1 ~]# smbclient -L 192.168.0.5
Enter SAMBA\root's password:

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          Disk      원격 관리
        C$              Disk      기본 공유
        IPC$            IPC       원격 IPC
        Utils           Disk
SMB1 disabled -- no workgroup available
[root@server1 ~]# mkdir /sambamount
[root@server1 ~]# mount -t cifs //192.168.0.5/Utils /sambamount
mount: /sambamount: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
[root@server1 ~]# dnf -y install cifs-utils

[root@server1 ~]# mount -t cifs //192.168.0.5/Utils /sambamount
Password for root@//192.168.0.5/Utils:  ****
[root@server1 ~]#

[root@server1 ~]# df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
devtmpfs            devtmpfs  957M     0  957M   0% /dev
tmpfs               tmpfs     975M     0  975M   0% /dev/shm
tmpfs               tmpfs     975M  8.8M  966M   1% /run
tmpfs               tmpfs     975M     0  975M   0% /sys/fs/cgroup
/dev/sda6           xfs        39G  1.8G   38G   5% /
/dev/sda3           xfs       5.0G   68M  5.0G   2% /home
/dev/sda2           xfs        50G  632M   50G   2% /var
/dev/sda1           xfs       2.0G  176M  1.9G   9% /boot
tmpfs               tmpfs     195M     0  195M   0% /run/user/0
//192.168.0.5/Utils cifs      120G   97G   23G  81% /sambamount

 

 

############################################################3333

윈도우에서 리눅스 폴더 가져다 share 해서 쓰기

 

 

[root@server1 /]# dnf -y install samba* cifs* 

[root@server1 /]# firewall-cmd --permanent --add-service=samba
success
[root@server1 /]# firewall-cmd --permanent --add-service=samba-client
success
[root@server1 /]# firewall-cmd --reload
success
[root@server1 /]#

 

[root@server1 /]# mkdir /public
[root@server1 /]# useradd user01
[root@server1 /]# passwd user01
Changing password for user user01.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@server1 /]#
[root@server1 /]# smbpasswd -a user01
New SMB password:
Retype new SMB password:
Added user user01.
[root@server1 /]# smbpasswd -e user01
Enabled user user01.

 

[root@server1 /]# vi /etc/samba/smb.conf

[public]

        comment = smb user01

        create mask = 0777

        directory mask = 0777

        guest ok = Yes

        path = /public

        read only = No

        write list = user01 root

 

[root@server1 /]# testparm   //오류확인

Load smb config files from /etc/samba/smb.conf

Loaded services file OK.

Server role: ROLE_STANDALONE

 

[root@server1 /]# firewall-cmd --list-service
cockpit dhcpv6-client samba samba-client ssh

 

 

[root@server1 /]#systemctl enable smb

root@server1 /]#systemctl start smb 

[root@server1 /]#systemctl enable nmb

root@server1 /]#systemctl start nmb

[root@server1 /]#systemctl enable firewalld

root@server1 /]#systemctl start firewalld

 

[root@server1 /]# semanage 
-bash: semanage: command not found 

[root@server1 /]# dnf -y install policycoreutils-python-utils-2.9-9.el8.noarch

[root@server1 /]# sudo semanage fcontext -a -t samba_share_t '/public(/.*)?'   //selinux samba 허용 

[root@server1 /]# restorecon -vvFR /public      //selinux relabeling 함
Relabeled /public from unconfined_u:object_r:default_t:s0 to system_u:object_r:samba_share_t:s0 

 

또는 간단히는

# setenforce 1

# getenforce

 

윈도우에서 리눅스 폴더로 접속

\\192.168.10.200\public

 

 

 

[root@server2 ~]# smbstatus

Samba version 4.12.3
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing
----------------------------------------------------------------------------------------------------------------------------------------
1856    test01       test01       192.168.10.1 (ipv4:192.168.10.1:60689)    SMB3_11           -                    partial(AES-128-CMAC)

Service      pid     Machine       Connected at                     Encryption   Signing
---------------------------------------------------------------------------------------------
test         1856    192.168.10.1  Sat Dec 26 05:06:14 PM 2020 EST  -            -
IPC$         1856    192.168.10.1  Sat Dec 26 05:06:14 PM 2020 EST  -            -

Locked files:
Pid          User(ID)   DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
1856         1001       DENY_NONE  0x100081    RDONLY     NONE             /test   .   Sat Dec 26 17:06:14 2020
1856         1001       DENY_NONE  0x100081    RDONLY     NONE             /test   .   Sat Dec 26 17:06:14 2020

[root@server2 ~]#

'linux' 카테고리의 다른 글

centos -dns 서버 설치  (0) 2020.12.28
Centos 8 - DB 설치  (0) 2020.12.27
Centos - nfs 설정  (0) 2020.12.27
centos linux -vsftpd 설정  (0) 2020.12.26
centos 8 - fuser  (0) 2020.12.21