CentOS 7 sambaおよびwindowsマッピングネットワークドライブ、ファイルタイミングバックアップ


第1歩:sambaサービスのインストール」yum install samba第2歩:sambaサービスの起動」systemctl start smb sambaの状態を表示するsystemctl status smb Activeを見ると運転中であることを説明する第3歩:ファイアウォールを閉じるsystemctl stop firewalld.サービス//サービス停止サービス//電源を切って起動すると同時にSELINUX=disabledを設定する(パソコンを再起動する必要がある)
vi/etc/selinux/configファイルでSELINUX=disabledを設定し、サーバーを再起動します.
ステップ4:ファイルにアクセスするためにユーザーを追加する必要がある」useradd lcd//ユーザーを追加するpasswd lcd//パスワードを変更sambaユーザーを作成するsmbpasswd-a lcd第5ステップ:sambaのプロファイルを変更する」vi/etc/samba/smb.conf//コンフィギュレーションファイル5.1にアクセスglobalでグローバルコンフィギュレーションの変更を行います:workgroup=WORKGROUP//ワークグループを定義します.つまりwindowsのワークグループコンセプトsecurity=user//セキュリティ認証方式user方式ntlm auth=yes//そうでなければwindows 7アクセスユーザ認証に失敗する5.2 confに新しいユーザ構成を追加する(4の構成を有効にする)[lcd]path=/cloud/lcd//共有ディレクトリbrowsable=yes writable=yes//ディレクトリ読み書き可能read only=no修正後のsmb.confは、[global]workgroup=WORKGROUP security=user passdb backend=tdbsam printing=cups printcap name=cups load printers=yes cups options=raw ntlm auth=yes[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[lcd]path=/cloud/lcd browsable=yes writable=yes read only=no手順6:共有ディレクトリのファイル権限を設定して共有ディレクトリに書き込み権限を追加し、windowsからlinuxにファイルを書き込むことができます.例えば私がここでhomeを共有ディレクトリに設定すると、端末に以下のコマンドを入力すればchmod-R 777/cloud/lcd(書き込み可能w=4可読r=2実行可能x=1)第7歩:sambaサービスの再起動」systemctl restart smb
テストと使用:win 7:10.xx.xx.xxlcdアカウントのパスワードを入力するよう求められます.——————————————————本文はCSDNブロガー「sparrowwf」のオリジナル文章で、CC 4.0 BY-SAの著作権契約に従い、原文の出典リンクと本声明を転載してください.テキストリンク:https://blog.csdn.net/sparrowwf/article/details/81064318
CentOSディスクファイルをマウントしておく
[root@localhost/]# yum install samba[root@localhost/]useradd -s/sbin/nologin jitai1[root@localhost/]smbpasswd -a jitai1
[root@localhost/]# vi/etc/samba/smb.conf[root@localhost/]# cat/etc/samba/smb.conf
[global]
workgroup = SAMBA
    workgroup = WORKGROUP 
    security = user
    ntlm auth = yes
    passdb backend = tdbsam

    printing = cups
    printcap name = cups
    load printers = yes
    cups options = raw

[homes]comment = Home Directoriesvalid users = %S, %D%w%Sbrowseable = Noread only = Noinherit acls = Yes
[printers]comment = All Printerspath =/var/tmpprintable = Yescreate mask = 0600browseable = No
[print$]comment = Printer Driverspath =/var/lib/samba/driverswrite list = @printadmin rootforce group = @printadmincreate mask = 0664directory mask = 0775
[jitai1]comment = jitai1path =/tmp/jitai1browsable = yeswritable = yesread only = no
win 10は、jitai 1ディレクトリをネットワークドライブにマッピングすることができる.win 10のメモ帳は、以下のように入力、startupZとして保存する.batファイルnet use Z:10.24.1.93jitai 1 jitai 1/user:jitai 1/persistent:yes
1.まずパソコンの左下でスタートメニューをクリックし、メニューから「運転」オプションを選択します.2.次に実行ウィンドウに「shell:startup」と入力し、「OK」をクリックします.3.この時点で開いているフォルダウィンドウが「windows 10起動」画面です.4.startupZ.batをこのディレクトリに入れ、ネットワークドライブを自動的にマッピングします.
Aサーバ10.24.1.93:[root@cent7x64 ~]# ssh-keygen -t rsa[root@cent7x64 ~]# cat ~/.ssh/id_rsa.pub[root@cent7x64 ~]# scp id_rsa.pub [email protected]:/root/.ssh/authorized_keys
Bサーバ10.24.111.91:[root@cent7x64 ~]# ssh-keygen -t rsa[root@cent7x64 ~]# cat ~/.ssh/id_rsa.pub[root@cent7x64 ~]# scp id_rsa.pub [email protected]:/root/.ssh/authorized_keys
10.24.111.93から10.24.111.91にファイルをコピーします.[root@cent7x64 ~]cat bakjitai1.sh#!/bin/bashscp -r/tmp/jitai1/[email protected]:/tmp/jitai1 date +%Y%m%d date +%H:%M:%S
[root@localhost tmp]# cat rmrfjitai1.sh !#/bin/bashrm -rf/tmp/jitai1/.
[root@localhost tmp]# cat/etc/crontab SHELL=/bin/bashPATH=/sbin:/bin:/usr/sbin:/usr/binMAILTO=root
For details see man 4 crontabs
Example of job definition:
.---------------- minute (0 - 59)
| .------------- hour (0 - 23)
| | .---------- day of month (1 - 31)
| | | .------- month (1 - 12) OR jan,feb,mar,apr ...
| | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| | | | |
* user-name command to be executed
/2 * root/tmp/bakjitai1.sh
/3 * root/tmp/rmrfjitai1.sh
タイミングコピーはパスワード検証を必要としません.