0
1

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 1 year has passed since last update.

UbuntuでSMB共有をしてみた

Last updated at Posted at 2022-07-11

Ubuntuでたまにファイル共有したくなるのですが、毎回忘れるのでメモを残します。

SMBサーバを立てる場合

まずは下のコマンドでSMBのサーバ用プログラムをインストールを行います。

sudo apt install samba

次に、共有するフォルダを作成します。一般的には/home配下で作成するみたいです。

sudo mkdir /home/test

設定ファイル/etc/samba/smb.confに下の設定を追記します。最初の[test]の部分は既に登録されている[global][home][printer]でなければ何でもいいみたいです。ちなみに、読み書きを許可し、誰でも入れる設定にしてあります。

[test]
path = /home/test
read only = no
guest ok = yes

SMBを起動します。

sudo service smbd start

クライアント側でSMBを使う場合

まず、下のコマンドでSMBクライアント用プログラムをインストールします。

sudo apt install cifs-utils

マウントするためのフォルダを作成します。今回は/mnt/testにします。

sudo mkdir /mnt/test

下のコマンドでマウントを行います。なお、//サーバのIPアドレス/の後には、設定ファイル/etc/samba/smb.confで書いた[test]の名前を書きます。(ディレクトリ名ではありません)

sudo mount -t cifs //サーバのIPアドレス/test /mnt/test

おわりに

今回も個人での使用を前提にしているため、セキュリティ設定とか行っていません。今後勉強したら追記します。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?