memos/Home Server/Samba.md

54 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

2024-08-26 11:55:58 +00:00
# 1. Samba 설치
2024-08-25 15:21:39 +00:00
```shell
sudo apt -y install samba
```
2024-08-26 11:55:58 +00:00
# 2. Samba user group 추가
2024-08-25 15:21:39 +00:00
[[../linux/Group#groupadd|Linux group add]]를 사용해 리눅스 유저 그룹을 추가한다.
2024-08-26 11:55:58 +00:00
# 3. User 추가
## 3.1. Linux user 추가
2024-08-25 15:21:39 +00:00
[[../linux/User#useradd|Linux user add]]를 사용해 리눅스 유저를 먼저 추가해야 한다. 이 때 유저 그룹은 samba를 지정한다.
2024-08-26 11:55:58 +00:00
## 3.2. smbpasswd
2024-08-25 15:21:39 +00:00
```shell
sudo smbpasswd -a [username]
```
```
New SMB password:
Retype new SMB password:
Added user tuska.
```
2024-08-26 11:55:58 +00:00
# 4. Samba 폴더 생성
2024-08-25 15:21:39 +00:00
```shell
sudo mkdir -p /mnt/md0/share/guest
sudo chown tuska:samba /mnt/md0/share
sudo chmod 775 /mnt/md0/share
```
2024-08-26 11:55:58 +00:00
# 5. Samba 설정
2024-08-25 15:21:39 +00:00
```shell
sudo vim /etc/samba/smb.conf
```
```
[share]
comment = samba share directory
path = /mnt/md0/share
read only = no
writable = yes
guest ok = no
valid user = kolpi12
create mask = 0777
force group = samba
```
2024-08-26 11:55:58 +00:00
# 6. Samba service 재시작
2024-08-25 15:21:39 +00:00
```shell
sudo service smbd restart
```
2024-08-26 11:55:58 +00:00
# 7. 공유 폴더 접속
2024-08-25 15:21:39 +00:00
`\\[server-ip]\[section 이름]`