**************************************************
sambaインストール:
[root@falcon21 ~]# yum -y install samba
インストール:
samba.x86_64 0:4.8.3-4.el7
依存性関連をインストールしました:
samba-common-tools.x86_64 0:4.8.3-4.el7
完了しました!
---------------------------------------------------
ユーザーをSambaサーバーアクセス用ユーザーとする
[root@falcon21 ~]# pdbedit -a hayato new password: retype new password: Unix username: hayato NT username: Account Flags: [U ] User SID: S-1-5-21-1372297135-2191849794-1204433890-1000 Primary Group SID: S-1-5-21-1372297135-2191849794-1204433890-513 Full Name: hayato Home Directory: \\falcon21\hayato HomeDir Drive: Logon Script: Profile Path: \\falcon21\hayato\profile Domain: FALCON21 Account desc: Workstations: Munged dial: Logon time: 0 Logoff time: 木, 07 2月 2036 00:06:39 JST Kickoff time: 木, 07 2月 2036 00:06:39 JST Password last set: 日, 17 2月 2019 10:25:49 JST Password can change: 日, 17 2月 2019 10:25:49 JST Password must change: never Last bad password : 0 Bad password count : 0 Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [root@falcon21 ~]# pdbedit -a kazuya 新規ユーザー作成時にsamba用ディレクトリ作成
[root@falcon21 ~]# mkdir /etc/skel/samba
既存ユーザーsamba用ディレクトリ作成
[root@falcon21 ~]# vi mkhomedir.sh
#!/bin/bash
for user in `ls /home`
do
id $user > /dev/null 2>&1
[ $? -eq 0 ] && \
[ ! -d /home/$user/samba ] && \
mkdir /home/$user/samba && \
chown $user:$user /home/$user/samba && \
echo "/home/$user/samba create"
done
------------------------------
samba用ディレクトリ作成実行
[root@falcon21 ~]# sh mkhomedir.sh
/home/hayato/samba create /home/kazuya/samba create
-------------------------
共有ディレクトリ作成
[root@falcon21 ~]# mkdir /home/samba
[root@falcon21 ~]# chown nobody:nobody /home/samba
------------------------
Samba設定
[root@falcon21 ~]# vi /etc/samba/smb.conf #[homes] # comment = Home Directories # valid users = %S, %D%w%S # browseable = No # read only = No # inherit acls = Yes [printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @printadmin root force group = @printadmin create mask = 0664 directory mask = 0775 [public] comment = Public Stuff path = /home/samba public = yes writable = yes only guest = yes vfs objects = recycle recycle:repository = .recycle recycle:keeptree = no recycle:versions = yes recycle:touch = no recycle:maxsize = 0 recycle:exclude = *.tmp ~$* #[Share] #path = /home/share/ #browsable =yes ##writable = yes #guest ok = yes #read only = no [Share] path = / browsable =yes writable = yes guest ok = yes read only = no -- INSERT --
--------------------------
Samba起動
[root@falcon21 ~]# systemctl start smb
[root@falcon21 ~]# systemctl start nmb
[root@falcon21 ~]# systemctl enable smb Created symlink from /etc/systemd/system/multi-user.target.wants/smb.service to /usr/lib/systemd/system/smb.service.
[root@falcon21 ~]# systemctl enable nmb Created symlink from /etc/systemd/system/multi-user.target.wants/nmb.service to /usr/lib/systemd/system/nmb.service.
[root@falcon21 ~]# systemctl status smb ● smb.service - Samba SMB Daemon Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled) Active: active (running) since 日 2019-02-17 11:06:28 JST; 2min 14s ago Docs: man:smbd(8) man:samba(7) man:smb.conf(5) Main PID: 11825 (smbd) Status: "smbd: ready to serve connections..." CGroup: /system.slice/smb.service ├─11825 /usr/sbin/smbd --foreground --no-process-group ├─11827 /usr/sbin/smbd --foreground --no-process-group ├─11828 /usr/sbin/smbd --foreground --no-process-group └─11829 /usr/sbin/smbd --foreground --no-process-group 2月 17 11:06:27 falcon21.space systemd[1]: Starting Samba SMB Daemon... 2月 17 11:06:28 falcon21.space smbd[11825]: [2019/02/17 11:06:28.741875, 0] ../lib...y) 2月 17 11:06:28 falcon21.space systemd[1]: Started Samba SMB Daemon. 2月 17 11:06:28 falcon21.space smbd[11825]: daemon_ready: STATUS=daemon 'smbd' fi...ns Hint: Some lines were ellipsized, use -l to show in full. [root@falcon21 ~]# systemctl status nmb ● nmb.service - Samba NMB Daemon Loaded: loaded (/usr/lib/systemd/system/nmb.service; disabled; vendor preset: disabled) Active: active (running) since 日 2019-02-17 11:06:38 JST; 3min 26s ago Docs: man:nmbd(8) man:samba(7) man:smb.conf(5) Main PID: 11837 (nmbd) Status: "nmbd: ready to serve connections..." CGroup: /system.slice/nmb.service └─11837 /usr/sbin/nmbd --foreground --no-process-group 2月 17 11:06:38 falcon21.space systemd[1]: Starting Samba NMB Daemon... 2月 17 11:06:38 falcon21.space nmbd[11837]: [2019/02/17 11:06:38.150978, 0] ../lib...y) 2月 17 11:06:38 falcon21.space systemd[1]: Started Samba NMB Daemon. 2月 17 11:06:38 falcon21.space nmbd[11837]: daemon_ready: STATUS=daemon 'nmbd' fi...ns 2月 17 11:07:01 falcon21.space nmbd[11837]: [2019/02/17 11:07:01.182014, 0] ../sou...2) 2月 17 11:07:01 falcon21.space nmbd[11837]: ***** 2月 17 11:07:01 falcon21.space nmbd[11837]: 2月 17 11:07:01 falcon21.space nmbd[11837]: Samba name server CENTOS7 is now a lo...01 2月 17 11:07:01 falcon21.space nmbd[11837]: 2月 17 11:07:01 falcon21.space nmbd[11837]: ***** Hint: Some lines were ellipsized, use -l to show in full.
-----------------------------------------------------
ごみ箱内のファイルを自動的に削除
[root@falcon21 ~]# yum -y install tmpwatch
自動削除スクリプト作成
[root@falcon21 ~]# vi /etc/cron.weekly/recyclewatch
#!/bin/bash
for user in `ls /home/`
do
if [ -d /home/$user/.recycle ]; then
tmpwatch -f 720 /home/$user/.recycle/
fi
done
---------------
[root@falcon21 ~]# chmod +x /etc/cron.weekly/recyclewatch
------------------------------------
root@falcon21 ~]# systemctl reload smb windows から、「ファイル名を指定して実行」 \\192.168.2.101\Share を入力
************************************************************************
投票数:0
平均点:0.00