새로운 라즈베리에 samba를 설치하려고 하니 전이랑 뭔가 달라졌네요
일단 samba -> nmbd 로 서비스명도 바뀌고
일단 설치를 진행해봤습니다
pi@rasp-ap:~ $ sudo apt update -y Get:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB] Get:2 https://download.docker.com/linux/raspbian buster InRelease [29.7 kB] Get:3 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB] Get:4 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB] Get:5 https://download.docker.com/linux/raspbian buster/stable armhf Packages [6,559 B] Get:6 http://archive.raspberrypi.org/debian buster/main armhf Packages [330 kB] Get:7 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages [58.7 kB] Get:8 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages [103 kB] Fetched 13.6 MB in 18s (752 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 70 packages can be upgraded. Run 'apt list --upgradable' to see them. |
sudo apt install samba -y
pi@rasp-ap:~ $ sudo apt install samba -y Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: containerd.io . . .
Load smb config files from /etc/samba/smb.conf Loaded services file OK. Server role: ROLE_STANDALONE
Done Setting up samba (2:4.9.5+dfsg-5+deb10u1+rpi1) ... Adding group `sambashare' (GID 116) ... Done. Samba is not being run as an AD Domain Controller: Masking samba-ad-dc.service Please ignore the following error about deb-systemd-helper not finding those services. (samba-ad-dc.service masked) Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service → /lib/systemd/system/nmbd.service. Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked. /usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service → /lib/systemd/system/smbd.service. Processing triggers for systemd (241-7~deb10u3+rpi1) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for libc-bin (2.28-10+rpi1) ... pi@rasp-ap:~ $ |
중간에 use WINS settings from DHCP 라고 물어보는데 No로 진행
로그를 잘보시면
설정파일 위치 : Load smb config files from /etc/samba/smb.conf
서비스 관련 링크생성을 확인할 수 있습니다
Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service → /lib/systemd/system/nmbd.service.
pi@rasp-ap:~ $ sudo smbpasswd -a pi New SMB password: Retype new SMB password: Added user pi. pi@rasp-ap:~ $ |
samba 접속을 위한 계정(pi) 패스워드 생성
pi@rasp-ap:~ $ hostname -I 192.168.0.29 |
ifconfig 로 해도 되지만 hostname -I를 사용했습니다
이정도만 해도 Samba로의 접근이 가능해집니다
MacOs: smb://192.168.0.29
Windows: \\192.168.0.29
접속을 위해 계정/패스워드 입력(우)
계정은 pi/패스워드는 위에서 만들어준걸로 하면 됩니다
연결이되면 디렉토리 리스트가 나오는데요
기본은 계정(pi) 홈 디렉토리입니다
연결된 상태로 좌측 하단을 보면 연필마크에 사선 표시가 되있는데
읽기전용이라는 의미 입니다
smb.conf 를 수정해서 읽기/쓰기 를 할 수 있도록 변경을 해야합니다
우선 samba 서비스를 중지하고 진행합니다
sudo service nmbd stop 혹은 sudo /etc/init.d/nmbd stop
pi@rasp-ap:~ $ sudo service nmbd stop pi@rasp-ap:~ $ sudo /etc/init.d/nmbd stop [ ok ] Stopping nmbd (via systemctl): nmbd.service. pi@rasp-ap:~ $ |
전에는 서비스명이 samba 였는데 nmbd로 변경되있네요
pi@rasp-ap:~ $ sudo vim /etc/samba/smb.conf
169 [homes] 170 comment = Home Directories 171 browseable = no 172 173 # By default, the home directories are exported read-only. Change the 174 # next parameter to 'no' if you want to be able to write to them. 175 read only = yes 176 177 # File creation mask is set to 0700 for security reasons. If you want to 178 # create files with group=rw permissions, set next parameter to 0775. 179 create mask = 0700 180 181 # Directory creation mask is set to 0700 for security reasons. If you want t o 182 # create dirs. with group=rw permissions, set next parameter to 0775. 183 directory mask = 0700 184 185 # By default, \\server\username shares can be connected to by anyone 186 # with access to the samba server. 187 # The following parameter makes sure that only "username" can connect 188 # to \\server\username 189 # This might need tweaking when using external authentication schemes 190 valid users = %S 185,1 78% |
내리다 보면 [homes] 라고 되있는부분이
공유디렉토리 설정부분입니다
[global] #전체적인 설정 workgroup=WORKGROUP #windows 작업그룹 dos charset = CP949 #windows charset display charset = UTF8 #화면에 표시되는 charset unix charset = UTF8 #unix계열 charset
[Raspberry] # 공유 디렉토리 명 comment = Hello Rasp # 디렉토리 설명 valid users = pi # 접근가능한 사용자(계정) path = /home/pi # 공유 디렉토리 경로 guest ok = no # 익명사용자 접근차단 writable = yes # 쓰기 가능 browseable = yes # 화면표시 create mask = 0777 # 모든권한(읽기/쓰기) directory mask = 0777 # 모든권한(읽기/쓰기) |
간단한 기존버전 설정 값들
pi@rasp-ap:~ $ sudo vim /etc/samba/smb.conf
169 [Rasp-ap] 170 comment = Rasp-ap 171 browseable = yes 172 path = /home/pi 173 # By default, the home directories are exported read-only. Change the 174 # next parameter to 'no' if you want to be able to write to them. 175 read only = no 176 writeable = yes 177 # File creation mask is set to 0700 for security reasons. If you want to 178 # create files with group=rw permissions, set next parameter to 0775. 179 create mask = 0777 180 181 # Directory creation mask is set to 0700 for security reasons. If you want t o 182 # create dirs. with group=rw permissions, set next parameter to 0775. 183 directory mask = 0777 184 185 # By default, \\server\username shares can be connected to by anyone 186 # with access to the samba server. 187 # The following parameter makes sure that only "username" can connect 188 # to \\server\username 189 # This might need tweaking when using external authentication schemes 190 valid users = pi 174,18 78% |
수정된 화면
homes -> Rasp-ap 로 공유디렉토리 명을 변경하고
read only = yes -> no
writeable = yes # 쓰기 가능
그래고 재시작하고 다시 붙으면
변경된 공유디렉토리명으로 표시됩니다
위에서는 Read only 옵션이 있었다면
변경후에는 쓰기가 가능해졌습니다
쓰고보니 바뀐건 서비스 시작 & 재시작 명령어...
댓글 영역