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 5 years have passed since last update.

Sambaで共有設定(Centos7)

Last updated at Posted at 2020-01-04

当方がCentOS7で立ち上げたときの備忘録

###1.sambaのインストール

yum install samba samba-client samba-common -y

###2.共有フォルダの作成

mkdir /home/hoge

###3.sambaの設定ファイルの編集

/etc/samba/smb.conf
# Global parameters
[global]
        dns proxy = No
        dos charset = CP932(文字化け防止)
        netbios name = CENTOS7(windowsで表示される名前)
        security = USER
        server string = Samba Server %v
        idmap config * : backend = tdb
        cups options = raw

[homes]
        browseable = No
        comment = Home Directories
        inherit acls = Yes
        read only = No
        valid users = %S %D%w%S

[share_samba] (最後に追加)
        guest ok = Yes
        guest only = Yes
        path = /home/share_samba(作成した共有フォルダ)
        read only = No

###4.共有フォルダのパーミッションの変更

sudo chmod -R 0777 /共有フォルダ
sudo chown -R nobody:nobody /共有フォルダ

###5.ファイアウォールの設定

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

###6.SELinuxの設定

setsebool -P samba_enable_home_dirs on
restorecon -R /共有フォルダ

###7.共有ユーザーをサーバー(Linux)側で作成

sudo useradd hoge
sudo passwd hoge

#Windows側のユーザー属性追加
sudo pdbedit -a -u hoge -f "hoge(任意)"
#パスワードはuseraddのときと同じやつ

#ユーザー作成の確認
sudo pdbedit -L

###8.sambaのサービスを再起動

sudo systemctl restart smb
sudo systemctl restart nmb

#samba起動を自動化
sudo systemctl enable smb
sudo systemctl enable nmb

###9.Windows側でアクセス

エクスプローラーで\\(鯖IP)\共有フォルダを検索
ユーザー名とパスワードを入力

###参考文献
https://www.rem-system.com/centos-samba/
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?