LoginSignup
1
2

More than 3 years have passed since last update.

ubuntu で samba で home ディレクトリを公開する

Last updated at Posted at 2019-12-30

ubuntu で samba で home ディレクトリを公開する

ubuntu 19.10 で確認

samba をインストール

sudo apt install -y samba

現在のログインユーザーを samba ユーザーとして追加

sudo pdbedit -a $USER

firewalld をインストール

sudo apt install -y firewalld

firewall で samba を許可

sudo firewall-cmd --add-service=samba --permanent
sudo firewall-cmd --reload

smb.conf を編集して home ディレクトリを有効化する

sudo vi /etc/samba/smb.conf
$ diff smb.conf.orig /etc/samba/smb.conf
175,177c175,177
< ;[homes]
< ;   comment = Home Directories
< ;   browseable = no
---
> [homes]
>    comment = Home Directories
>    browseable = no
181c181
< ;   read only = yes
---
>    read only = no 
196c196,197
< ;   valid users = %S
---
>    valid users = %S
>    users = %S

設定ファイルを反映

sudo systemctl restart  smbd nmbd

再起動後に自動的に samba が起動するように設定

sudo systemctl enable   smbd nmbd

(オプション) mDNS をインストールして ホスト名.local でアクセスできるようにする

ホスト名 は linux のホスト名に読み替えてください。

※ 関連記事 ubuntu での mDNS(=multicast DNS) の有効化方法

avahi-daemon をインストール

sudo apt install -y avahi-daemon

mDNS を許可する

sudo firewall-cmd --add-service=mdns  --permanent
sudo firewall-cmd --reload

アクセス方法

\\xxx.xxx.xxx.xxx\username または ホスト名.local\username でアクセスできる。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2