시스템/Linux2013. 3. 13. 09:40

리눅스에서 윈도우 공유폴더 Mount

 

오늘은 윈도우에서 공유한 폴더를 리눅스에서 mount 하는 방법을 포스팅 하겠습니다.

 

리눅스에서 윈도우 공유폴더 Mount 하기 위해서는 당연한 이야기 이지만 두 서버간 방화벽등의 보안장비에서 공유포트 또는

 IP단위로 허용이 되어있어야 합니다.

 

1. Windows 공유(WindowsServer2008)

 - 리눅스에서 윈도우 폴더를 Mount 하기 위하여 Windows서버에 공유를 추가합니다.

   (제 서버는 Windows Server 2008 입니다.)

 

 

- 기본으로 Administrator 계정이 설정되지만 로컬에 있는 다른 계정을 추가하여 소유자로 설정할 수 있습니다.

 

 

- 권한은 사용 목적에 따라서 설정합니다. (전 테스트용으로 모든 권한 허용)

 

 

2. Linux 에서 Mount 하기

 - Linux 에서 Windows 공유폴더를 마운트 하기 위해 사전에 공유가 되어있는 폴더를 확인 합니다.

   확인하기 위하여 Linux Server 에 smbclient 명령어로 확인 합니다.

   (smbclient 로 굳이 확인하지 않아도 되며, 해당 명령어가 없을경우 yum install samba-client 로 설치합니다.)

 

[root@b ~]# smbclient -L 192.168.0.250 -U administrator Password: Domain=[WIN-8HTL0M86Y6M] OS=[Windows Server (R) 2008 Standard 6002 Service Pack 2] Server=[Windows Server (R) 2008 Standard 6.0] Sharename Type Comment --------- ---- ------- ADMIN$ Disk 硅 ? C$ Disk 0?? D$ Disk 0?? Downloads Disk IPC$ IPC 硅 IPC Test Disk Users Disk

 

위 처럼 smbclient -L [Windows공유서버IP] -U [공유폴더에 접근가능한 계정] 명령어로 확인하면 위에 공유한 TEST 라는

공유 폴더를 확인할 수 있습니다.

 

 

 

[root@b ~]# mount -t cifs ⁄⁄192.168.0.250⁄TEST ⁄TEST -o username="administrator",password="test1234"

 

mount -t cifs //[Windows공유서버IP]/[공유폴더이름] /[공유할 폴더명] -o username="[공유계정]",password="[암호]"

 

mount 명령어로 위와 같이 윈도우 공유폴더를 리눅스상에서 확인할 수 있습니다.

mount 의 type 은 cifs 로 설정하고, username 과 password 를 입력해두면 시스템이 부팅될때 자동으로 Mount 할 수 있습니다.

 

 

[root@b ~]# vi ⁄etc⁄rc.local

#!⁄bin⁄sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch ⁄var⁄lock⁄subsys⁄local

⁄bin⁄mount -t cifs ⁄⁄192.168.0.250⁄TEST ⁄TEST -o username="administrator",password="test1234"




[root@b ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
⁄dev⁄rd⁄c0d0p3         31G   13G   17G  44% ⁄
⁄dev⁄rd⁄c0d0p1        190M   17M  164M  10% ⁄boot
tmpfs                 760M     0  760M   0% ⁄dev⁄shm
⁄⁄192.168.0.250⁄TEST
                       69G  2.7G   66G   4% ⁄TEST

정상적으로 Mount가 완료되었습니다. 이제 Linux 에서 파일을 생성하여 Windows 서버에서 확인해보겠습니다.

 

[root@b TEST]# echo "test 완료" >> test.txt
[root@b TEST]#
[root@b TEST]# ls -al
total 9
drwxrwxrwx  1 root root    0 May 21 12:30 .
drwxr-xr-x 25 root root 4096 May 21 11:57 ..
-rwxrwSrwx  1 root root   10 May 21 12:30 test.txt

 

 

궁금하신 사항은 댓글 주세요.^^

 

▽도움이 되셨다면 아래의 손가락광고배너 한번 클릭해주는 센스는 매우 감사ㅠ_ㅠ

 

 

 

Posted by 소울하트