Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 63

Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 73

Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 89

Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 102

Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Cookie/Jar.php on line 111

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91

Deprecated: Return type of AIOSEO\Plugin\Common\Models\Model::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 409

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174
CentOS7にSambaサーバを立ててWindows/Macとファイルを共有する | reyfox blog

reyfox blog

reyfox tech info

CentOS Linux Samba

CentOS7にSambaサーバを立ててWindows/Macとファイルを共有する

投稿日:

Linux上にsambaサーバを立てて、Windows及びMacとファイル共有をします。

ストレージは以前増設した3TBのHDDを用いて3TBすべてを共有してNASのように使用します。

Intel NUC に USB-HDDを増設する

Sambaの設定

まずは、yumコマンドでSambaサーバのインストールから。


yum -y install samba samba-common

コンフィグファイルを調整します。
今回の利用用途は他のマシンから特定のユーザでのみアクセス可能な共有ポイントを作るという方法なので、ユーザ認証が必須となります。


cd /etc/samba
vi smb.conf

コンフィグファイルの内容( /etc/samba/smb.conf )


[global]
	workgroup = WORKGROUP
	security = user
	netbios name = reyfox

	passdb backend = tdbsam

	#printing = cups
	#printcap name = cups
	load printers = no
	#cups options = raw
	dos charset = CP932
	wins support = yes
	disable spoolss = yes
	unix charset = UTF-8
	mangled names = no
	vfs objects = catia
	catia:mappings = 0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6

[reyfox_share]
        comment = Share Folder for All Users
        path = /var/mnt/
        browsable = yes
        writable = yes
        read only = no

文字コードはCP932、プリンターを使用しない、シェア名は[reyfox_share]、Pathは /var/mnt などを設定します。
必要に応じて各種パラメータを調整してください。

Sambaユーザの追加


useradd -M share_user
passwd share_user
# share_user 用のパスワードを設定
pdbedit -a -u share_user -f "share user"
# 認証用パスワードを設定(share_userと同じパスワードにする)

Sambaのアクセスが有る部分へのパーミッションの変更


chmod 777 /var/mnt/

Sambaの起動と自動実行


systemctl start smb nmb
systemctl enable smb nmb

注意点

SELinuxが有効だとユーザ認証に失敗したり接続がうまく行かなかったりしますので、無効化することをおすすめします。
また、Firewallが有効な場合、適切な設定をするかOffにしないと接続できません。

CentOS7の初期設定

あとは、Windowsエクスプローラ欄に \\[サーバ名またはサーバIP]\reyfox_share # 今回の場合

MacならFinder上でCmd+K→アドレスを smb://[サーバ名またはサーバIP]/

で接続するとユーザとパスワードが求められ、その後普通のディスクとして使用できます。
Windowsの場合は、ネットワークドライブに割り当てておくと扱いやすいです。

-CentOS, Linux, Samba

執筆者:

関連記事

CentOS7にApacheをインストール

CentOS7はnetworkインストールで最小構成だと httpd(Apache)が入りません。しかし、yumコマンドで簡単にインストールすることが出来ます。 インストール yum install …

CentOS7上でiperfを使いネットワークの速度を測定

iperf というソフトを使うと、ネットワークの速度を測定できます。主にLAN内の速度(スループット)を測るために使用します。 iperf のインストール yum install epel-relea …

Intel NUC BOXNUC7PJYHのUnix Bench

Intel NUC BOXNUC7PJYHを購入しました。 BOXNUC7PJYHのスペックは下記の通りとなります。 CPU: Intel Pentium Silver J5005 @ 1.5Ghz( …

CentOS7で内向き専用DNSサーバを立てる

内向きDNSとは、LAN内でだけドメイン名を解決できるDNSサーバを言います。今回は、LAN内だけでドメイン名を解決するDNSサーバを立て、デフォルトのDNSとして動作するように設定します。なお、内向 …

PHPMyAdminの設置

PHPをインストールしましたが、DBを操作するのに便利なのがPHPMyAdminです。もちろんコマンドラインからも行えますがユーザの追加やユーザ専用のDBを作るとき何度もパスワードを入力したりするのが …


Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Utils/Database.php on line 535

Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/blog.reyfox.com/htdocs/wp/wp-content/plugins/all-in-one-seo-pack/app/Common/Models/Model.php on line 174