문서의 이전 판입니다!


리눅스에서 삼바를 마운트하기 (Mount CIFS)

윈도우에서 공유한 폴더우분투 (Ubuntu) 리눅스에서 내 디렉토리로 연결할 수 있다. 우분투에서는 smbfs 가 아닌 CIFS(Common Internet File System) 를 사용함.

일단 smbclient 가 설치되어 있지 않으면 설치한다.

sudo apt-get install smbclient cifs-utils

아래 명령어로 연결할 컴퓨터를 조사해본다

smbclient -L 192.168.0.11 -U%   
Domain=[VASLORNET] OS=[Unix] Server=[Samba 4.1.18]

        Sharename       Type      Comment
        ---------       ----      -------
        music           Disk      System default shared folder
        photo           Disk      System default shared folder
        video           Disk      System default shared folder
        web             Disk      System default shared folder
        IPC$            IPC       IPC Service ()
Domain=[VASLORNET] OS=[Unix] Server=[Samba 4.1.18]

        Server               Comment
        ---------            -------
        BOX
        VASLOR               Sam

        Workgroup            Master
        ---------            -------
        VASLORNET            VASLOR

이와 비슷하게 나온다.

아래 명령어로 마운트 할 수 있다.

sudo mount -t cifs //컴퓨터이름/공유이름 /공유할/디렉토리

하지만 몇 가지 문제가 있다. 마운트한 디렉토리는 root 가 소유하고 있고, 한글로된 파일명은 모조리 깨져나온다. 아래와 같은 옵션을 주어 해결할 수 있다.

sudo mount -t cifs -o uid=<자신의uid>,gid=<자신의gid>,iocharset=utf8,codepage=cp949 //컴퓨터이름/공유이름 /공유할/디렉토리

자신의 uid 와 gid 는 아래의 방법으로 알 수 있다. 아래 결과의 1000 1000 부분이 제 uid 와 gid 임. 그리고 utf8 을 utf-8 로 입력하면 요상한 에러를 냅니다.

ls -n
합계 4
-rwxr-xr-x 1 1000 1000 125 2006-02-11 15:48 smbmount.sh

아이디와 암호를 입력해야하는 공유 폴더라면 username 과 password 옵션을 추가해줘라.

$ sudo mount -t cifs -o username=<계정이름>,password=<암호>,uid=<자신의uid>,gid=<자신의gid>,iocharset=utf8,codepage=cp949 //컴퓨터이름/공유이름 /공유할/디렉토리

같이 보기

연결문서