오늘은 무엇을 할 것인가?
samba라는 패키지를 설치해
같은 네트워크에 있는 컴퓨터나 스마트폰에서
서버에 있는 파일을 읽고 쓸 수 있게 할 것 이다.
검색부터 해보자
삼바 설치법부터 삼바의 역사까지 잘 나와있다.
저런 사람들이 더 많아졌으면 행복할 것 같다.
이번엔 진짜 설치한다.
먼저 samba가 설치되어 있는지 확인하라고 한다.
위 블로그는
rpm -qa | grep samba
명령을 써서 확인했지만,
나는 데비안을 사용하고 있기 때문에
dpkg --get-selections | grep samba
명령을 사용해서 알아본다.
그냥 samba가 아니고 애매하게 samba-libs다.
이상하다. 그냥 새로 설치해보는게 좋겠다.
살면서 얼마 맞은적 없는 감이 이번엔 맞았다.
우리가 설치해야하는건 samba와 samba-common-bin이다.
samba-common-bin은 지금까지 설치하라고 해서 설치했는데.
그 이유는 samba-common-bin이 없으면 samba 명령어를 사용할 수 없기 때문이라고 한다.
http://www.rasplay.org/?p=11142
sudo apt install samba
sudo apt install samba-common-bin
명령으로 두 패키지를 설치해준다.
에러가 나타났다
Media change: please insert the disc labeled
라고 지껄일 수도 있다....
/etc/apt/sources.list 파일에 뭔가 문제가 있다는 것 같다.
sudo nano /etc/apt/sources.list
같은걸로 열어보니 여윽시 문제가 있었다.
#
# deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official amd64 DVD Binary-1 201$
deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official amd64 DVD Binary-1 2018$
# Line commented out by installer because it failed to verify:
#deb http://security.debian.org/debian-security stretch/updates main contrib
# Line commented out by installer because it failed to verify:
#deb-src http://security.debian.org/debian-security stretch/updates main contrib
# stretch-updates, previously known as 'volatile'
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://deb.debian.org/debian/ stretch-updates main contrib
# deb-src http://deb.debian.org/debian/ stretch-updates main contrib
에서 cdrom을 주석처리하고,
다른 주석처리된 주소들을 주석해제해보자.
#
# deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official amd64 DVD Binary-1 201$
#deb cdrom:[Debian GNU/Linux 9.5.0 _Stretch_ - Official amd64 DVD Binary-1 2018$
deb http://ftp.kr.debian.org/debian stretch main contrib
deb-src http://ftp.kr.debian.org/debian stretch main contrib
# Line commented out by installer because it failed to verify:
deb http://security.debian.org/debian-security stretch/updates main contrib
# Line commented out by installer because it failed to verify:
deb-src http://security.debian.org/debian-security stretch/updates main contrib
# stretch-updates, previously known as 'volatile'
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
deb http://deb.debian.org/debian/ stretch-updates main contrib
deb-src http://deb.debian.org/debian/ stretch-updates main contrib
아 그리고 이왕이면 한국서버를 써보고싶다.
"패키지가 후보에 없다."이런식의 에러가 뜨길래
stretch-updates를 stretch로 바꿨다.
deb http://ftp.kr.debian.org/debian stretch main contrib
deb-src http://ftp.kr.debian.org/debian stretch main contrib
저장하고 업데이트, 업그레이드해보자.
시간이 조금 오래걸릴 수도 있겠다.
sudo apt update
sudo apt upgrade
잘된다 으흫
삼바 계정을 추가하자
삼바를 설치했다면
sudo smbpasswd -a 사용자이름
명령으로 계정을 추가한다.
samba-common-bin이 설치 안돼있으면 이 명령을 못 쓴다고 한다.
삼바 설정을 하자
계정이 추가되었으면 설정을 조금 할 것 이다.
삼바 설정파일은 /etc/samba/smb.conf다.
sudo nano /etc/samba/smb.conf
같은걸로 열어주자.
친절하게 예시가 적혀있다.
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700
comment는 표시 할 설명같은것 같다
path는 공유 할 기본경로이다.
guest ok는 익명으로 로그인 할 수 있는지 같다.
browseable이 켜져있을때는 네트워크를 탐색했을 때 표시가 됐었다.
create mask는 파일을 만들었을 때 파일에 적용되는 권한이고,
directory mask는 디렉토리를 만들었을 때 디렉토리에 적용되는 권한인듯하다.
추가로 [homes] 프로필에 있던 valid users를 써줬는데,
아마 여기에 적힌 사용자만 접속할 수 있게 해주는 것 같다.
그리고 read only를 꺼줘야 파일을 읽고 쓸 수 있을 것이다.
예ㅡㅡㅡㅡㅡㅡ시
[bigfoodrive]
comment = I am groot
path = /usr/local/share/bigfood
read only = no
valid users = bigfood
guest ok = no
browseable = no
create mask = 0600
directory mask = 0700
적당히 된 것 같으면 저장하고 삼바 데몬을 재시작한다.
sudo service smbd restart
윈도우에서 리눅스에 연결하기
browseable옵션을 꺼뒀으니 탐색으로는 못찾을 것이다.
내 PC에서 찾을 수 있는 "네트워크 위치 추가"나 "네트워크 드라이브 연결"로 연결할 수 있다.
탐색기의 주소창이나 실행 창에서도 연결 할 수 있고, cmd에서도 가능한 것으로 알고 있다.
졸리니까 실행창으로 간단하게 연결하고 자자.
\\서버아이피\프로필이름
프로필 이름이 확실히 맞는진 모르겠는데
프로필을 바꿔서 그걸로 접속해도 접속이 됐었다.
smbpasswd로 등록한 계정과 비밀번호를 입력하면 접속이 될 것이다.
ssh와 삼바만 있어도 같은 네트워크에서는 충분히 nas라고 부를 수 있을 것 같다.
'하라는 공부는 안하고 > 컴퓨터하고있네' 카테고리의 다른 글
갑자기 NAS가 만들고 싶어졌다. #3 (1) | 2018.08.16 |
---|---|
갑자기 NAS가 만들고 싶어졌다. #1 (0) | 2018.07.17 |
윈도우 8 자동저장 스크린샷 (0) | 2015.02.05 |
윈도우8 cmd에 드래그 앤 드롭 (0) | 2015.02.05 |
윈도우7 스트레오믹스가 사라졋을때/없을때 (0) | 2014.04.23 |