Ubuntu16.04にsambaサーバを立てる
スポンサーリンク
インストール
$ sudo apt-get -y install samba
設定ファイル編集
$ sudo vim /etc/samba/smb.conf
で設定ファイルを編集する
global
セクション
[global] unix charset = UTF-8 dos charset = CP932 writable = yes guest ok = no vfs objects = recycle recycle:repository = .recycle recycle:keeptree = no recycle:touch = yes recycle:versions = yes recycle:maxsize = 0
homes
セクション
# Un-comment the following (and tweak the other settings below to suit) # to enable the default home directory shares. This will share each # user's home directory as \\server\username [homes] comment = Home Directories browseable = yes # By default, the home directories are exported read-only. Change the # next parameter to 'no' if you want to be able to write to them. ; read only = yes read only = no # File creation mask is set to 0700 for security reasons. If you want to # create files with group=rw permissions, set next parameter to 0775. ; create mask = 0700 # Directory creation mask is set to 0700 for security reasons. If you want to # create dirs. with group=rw permissions, set next parameter to 0775. ; directory mask = 0700 # By default, \\server\username shares can be connected to by anyone # with access to the samba server. # Un-comment the following parameter to make sure that only "username" # can connect to \\server\username # This might need tweaking when using external authentication schemes valid users = %S
プリンタ
不要なので無効にする
;[printers] ; comment = All Printers ; browseable = no ; path = /var/spool/samba ; printable = yes ; guest ok = no ; read only = yes ; create mask = 0700 ; ;# Windows clients look for this share name as a source of downloadable ;# printer drivers ;[print$] ; comment = Printer Drivers ; path = /var/lib/samba/printers ; browseable = yes ; read only = yes ; guest ok = no
サービス起動
$ sudo systemctl start smbd nmbd $ sudo systemctl enable smbd nmbd
Sambaユーザの追加
下記コマンドでユーザを追加できる。
追加後にサービスを再起動する必要はない。
$ sudo smbpasswd -a ユーザ名 New SMB password: パスワード入力 Retype new SMB password: パスワード再入力 Added user ユーザ名.