0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu Server 21.04 に Samba サーバを立てて Mac とファイルを共有する

Posted at

本記事の前提

  1. Ubuntu Server 21.04 がインストールされている
  2. Mac から Ubuntu Server のファイルを参照したい

設定手順

まずは Samba サーバのパッケージをインストールします。

$ sudo apt-get install samba

次に、Samba を使うユーザを作成します。
ユーザ名は Ubuntu Server, Mac, Samba で共通化しておくのが無難です。

$ sudo pdbedit -a hajime-f
new password:
retype new password:
Unix username:        hajime-f
NT username:
Account Flags:        [U          ]
User SID:             S-1-5-21-3096135977-926823050-829666163-1000
Primary Group SID:    S-1-5-21-3096135977-926823050-829666163-513
Full Name:            Hajime Fujita
... (後略)

次に、/etc/samba/smb.conf を編集します。デフォルトの設定ファイルに追記・修正した箇所のみを示すと、下記のとおりです。

/etc/samba/smb.conf
[global]
   workgroup = ISLANDS
   unix extensions = no

[homes]
   writeable = yes 
   create mask = 644
   directory mask = 755

workgroupISLANDS になっているのは、私が各マシンのホスト名に南の島の名前をつけるという個人的なポリシーを持っているからです。

最後に、Samba デーモンを再起動します。ステータスがきちんと「Active: active (running)」になっていることも確認しておきましょう。

$ sudo service smbd restart
$ sudo service smbd status
● smbd.service - Samba SMB Daemon
     Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-05-10 06:12:55 UTC; 52s ago
...(中略)
May 10 06:12:55 phuket systemd[1]: Starting Samba SMB Daemon...
May 10 06:12:55 phuket systemd[1]: Started Samba SMB Daemon.

Mac から Ubuntu Server に接続する

Finder のメニューバーで、「移動」→「サーバへ接続」を選びます。

Screenshot 2021-05-10 16.03.04.png

「サーバへ接続」のポップアップが出たら、下記のように、「smb://(IPアドレス)」し、「接続」します。

Screenshot 2021-05-10 15.18.22.png

Samba ユーザのユーザ名とパスワードを聞かれるので、入力しましょう。

Screenshot 2021-05-10 15.16.26.png

ということで、Ubuntu サーバのホームディレクトリを参照できました。

Screenshot 2021-05-10 16.06.32.png

ホームディレクトリは、/Volumes/hajime-f にマウントされているので、適当にシンボリックリンクでも張っておきましょう。

0
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?