Ubuntu MATE (18.04.2) にsambaで接続する

手順

  • sambaのインストール
$sudo apt install samba

tdb-tools (1.3.15-2) を展開しています...
以前に未選択のパッケージ samba を選択しています。
.../02-samba_2%3a4.7.6+dfsg~ubuntu-0ubuntu2.11_armhf.deb を展開する準備をしています ...
samba (2:4.7.6+dfsg~ubuntu-0ubuntu2.11) を展開しています...
以前に未選択のパッケージ attr を選択しています。
.../03-attr_1%3a2.4.47-2build1_armhf.deb を展開する準備をしています ...
attr (1:2.4.47-2build1) を展開しています...
以前に未選択のパッケージ libnl-route-3-200:armhf を選択しています。
.../04-libnl-route-3-200_3.2.29-0ubuntu3_armhf.deb を展開する準備をしています ...
libnl-route-3-200:armhf (3.2.29-0ubuntu3) を展開しています...
以前に未選択のパッケージ libibverbs1:armhf を選択しています。
.../05-libibverbs1_17.1-1ubuntu0.1_armhf.deb を展開する準備をしています ...
libibverbs1:armhf (17.1-1ubuntu0.1) を展開しています...
以前に未選択のパッケージ ibverbs-providers:armhf を選択しています。
.../06-ibverbs-providers_17.1-1ubuntu0.1_armhf.deb を展開する準備をしています ...
ibverbs-providers:armhf (17.1-1ubuntu0.1) を展開しています...
以前に未選択のパッケージ librados2 を選択しています。
.../07-librados2_12.2.11-0ubuntu0.18.04.2_armhf.deb を展開する準備をしています ...
librados2 (12.2.11-0ubuntu0.18.04.2) を展開しています...
以前に未選択のパッケージ libcephfs2 を選択しています。
.../08-libcephfs2_12.2.11-0ubuntu0.18.04.2_armhf.deb を展開する準備をしています ...
libcephfs2 (12.2.11-0ubuntu0.18.04.2) を展開しています...
以前に未選択のパッケージ samba-dsdb-modules を選択しています。
.../09-samba-dsdb-modules_2%3a4.7.6+dfsg~ubuntu-0ubuntu2.11_armhf.deb を展開する準備をしています ...
samba-dsdb-modules (2:4.7.6+dfsg~ubuntu-0ubuntu2.11) を展開しています...
以前に未選択のパッケージ samba-vfs-modules を選択しています。
.../10-samba-vfs-modules_2%3a4.7.6+dfsg~ubuntu-0ubuntu2.11_armhf.deb を展開する準備をしています ...
samba-vfs-modules (2:4.7.6+dfsg~ubuntu-0ubuntu2.11) を展開しています...
python-dnspython (1.15.0-1) を設定しています ...
ufw (0.36-0ubuntu0.18.04.1) のトリガを処理しています ...
samba-vfs-modules (2:4.7.6+dfsg~ubuntu-0ubuntu2.11) を設定しています ...
libnl-route-3-200:armhf (3.2.29-0ubuntu3) を設定しています ...
libc-bin (2.27-3ubuntu1) のトリガを処理しています ...
systemd (237-3ubuntu10.22) のトリガを処理しています ...
tdb-tools (1.3.15-2) を設定しています ...
update-alternatives: /usr/bin/tdbbackup (tdbbackup) を提供するために自動モードで /usr/bin/tdbbackup.tdbtools を使います
man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ...
samba (2:4.7.6+dfsg~ubuntu-0ubuntu2.11) を設定しています ...
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 samba-ad-dc.service.
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.
samba-dsdb-modules (2:4.7.6+dfsg~ubuntu-0ubuntu2.11) を設定しています ...
attr (1:2.4.47-2build1) を設定しています ...
libibverbs1:armhf (17.1-1ubuntu0.1) を設定しています ...
librados2 (12.2.11-0ubuntu0.18.04.2) を設定しています ...
libcephfs2 (12.2.11-0ubuntu0.18.04.2) を設定しています ...
ibverbs-providers:armhf (17.1-1ubuntu0.1) を設定しています ...
libc-bin (2.27-3ubuntu1) のトリガを処理しています ...
systemd (237-3ubuntu10.22) のトリガを処理しています ...
ufw (0.36-0ubuntu0.18.04.1) のトリガを処理しています ...
  • sambaのユーザ設定
$sudo pdbedit -a cutxout
new password:
retype new password:
Unix username:        cutxout
NT username:          
Account Flags:        [U          ]
User SID:             S-1-5-21-587575283-722104280-531879302-1000
Primary Group SID:    S-1-5-21-587575283-722104280-531879302-513
Full Name:            cutxout
Home Directory:       \\rp3\cutxout
HomeDir Drive:        
Logon Script:         
Profile Path:         \\rp3\cutxout\profile
Domain:               RP3
Account desc:         
Workstations:         
Munged dial:          
Logon time:           0
Logoff time:          never
Kickoff time:         never
Password last set:    土, 15  6月 2019 10:23:08 JST
Password can change:  土, 15  6月 2019 10:23:08 JST
Password must change: never
Last bad password   : 0
Bad password count  : 0
Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  • /etc/samba/smb.confの編集
    • [global]セクションに、以下の文字列を追加
## Character Set ##
unix charset = UTF-8
dos charset = CP932
    • [homes]セクションに、以下の文字列を追加
comment = Home Directories
browseable = no
read only = no
valid users = %S
  • smbd/nmbdの再起動
$sudo systemctl restart smbd nmbd
  • 動作確認
$sudo tail /var/log/samba/log.smbd
[2019/06/15 10:31:04.298043,  0] ../lib/util/become_daemon.c:124(daemon_ready)
  STATUS=daemon 'smbd' finished starting up and ready to serve connections

$ sudo tail /var/log/samba/log.nmbd
[2019/06/15 10:31:03.922425,  0] ../source3/nmbd/nmbd.c:58(terminate)
  Got SIGTERM: going down...
[2019/06/15 10:31:04.077190,  0] ../lib/util/become_daemon.c:124(daemon_ready)
  STATUS=daemon 'nmbd' finished starting up and ready to serve connections
[2019/06/15 10:31:26.028932,  0] ../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
  *****

  Samba name server RP3 is now a local master browser for workgroup WORKGROUP on subnet 192.168.100.4

  *****
top - 10:53:57 up 1 day, 16:16,  3 users,  load average: 0.86, 0.97, 0.78
Tasks: 188 total,   1 running, 137 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.3 us,  3.3 sy,  0.0 ni, 90.7 id,  3.7 wa,  0.0 hi,  2.1 si,  0.0 st
KiB Mem :   946152 total,    34568 free,   302204 used,   609380 buff/cache
KiB Swap:   131068 total,   130292 free,      776 used.   553640 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 9635 cutxout   20   0   45004  16184  13388 S  11.6  1.7   2:18.60 smbd
 9654 root      20   0       0      0      0 I   8.6  0.0   0:10.23 kworker/0:2
    7 root      20   0       0      0      0 S   3.3  0.0   1:22.38 ksoftirqd/0
  222 root      20   0       0      0      0 D   1.7  0.0   0:21.89 usb-storage
 9638 cutxout   20   0    8120   2592   2052 R   1.3  0.3   0:11.54 top
 9646 root      20   0       0      0      0 D   1.0  0.0   0:01.72 kworker/u8:1
   51 root      20   0       0      0      0 S   0.7  0.0   0:10.32 kswapd0
 9529 root      20   0       0      0      0 I   0.3  0.0   0:00.36 kworker/1:0
 9597 root      20   0   39424   4636   2708 S   0.3  0.5   0:00.64 smbd-notifyd
    1 root      20   0   28968   5108   3380 S   0.0  0.5   0:15.39 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.14 kthreadd
    4 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 kworker/0:0H
    6 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 mm_percpu_wq
    8 root      20   0       0      0      0 I   0.0  0.0   0:04.12 rcu_preempt
    9 root      20   0       0      0      0 I   0.0  0.0   0:00.01 rcu_sched
   10 root      20   0       0      0      0 I   0.0  0.0   0:00.00 rcu_bh
   11 root      rt   0       0      0      0 S   0.0  0.0   0:00.02 migration/0
   12 root      20   0       0      0      0 S   0.0  0.0   0:00.00 cpuhp/0
   13 root      20   0       0      0      0 S   0.0  0.0   0:00.00 cpuhp/1
   14 root      rt   0       0      0      0 S   0.0  0.0   0:00.04 migration/1
   15 root      20   0       0      0      0 S   0.0  0.0   0:03.33 ksoftirqd/1

f:id:cutxout:20190615104445j:plain
f:id:cutxout:20190615104441j:plain

  • できました!