Rsync through service synchronization, Linux system logs, screen tools

Source: Internet
Author: User
Tags auth rsync

Rsync syncs through services

/etc/rsyncd.conf is the default profile for Rsync, the profile does not exist, and you need to edit the content

Operations on the primary server:

1, [[email protected] rsync]# cat/etc/rsyncd.conf

#启动的端口

port=873

#log文件

Log File=/var/log/rsync.log

PID File=/var/run/rsyncd.pid

#必须写服务端的IP

address=192.168.3.83

[Test]

#模块存的地方

Path=/tmp/rsync

#使用true后, files can only be transferred in/tmp/rsync

Use Chroot=true

#最大连接数

Max Connections=4

#设置为no后可以在客户端内上传数据到服务器端

Read Only=no

List=true

Uid=root

Gid=root

#auth Users=test

#secrets file=/etc/rsyncd.passwd

Can write IP, network segment

Hosts allow=192.168.3.76

2. Start the service

[Email protected] etc]# rsync--daemon

[[Email protected] etc]# PS aux | grep rsync

Root 7896 0.2 0.0 107636 668? Ss 10:36 0:00 rsync--daemon

Root 7898 0.0 0.0 103320 892 pts/2 s+ 10:36 0:00 grep rsync

3. Synchronize the/etc/fstab files to the/tmp/rsync directory on the client

[Email protected] ~]# Rsync-avp/etc/fstab 192.168.3.83::test/

4. Synchronize server-side content to Local on the client

[Email protected] ~]# RSYNC-AVP 192.168.3.83::test/passwd/tmp/222.txt

5. Add password file-security

Test: For an authenticated user

On the server:

New configuration file:

Auth users=Test

Secrets file=/etc/rsyncd.passwd

[Email protected] backup]# CAT/ETC/RSYNCD.PASSWD

Test: 123qwe

chmod 600/etc/rsyncd.passwd


Operations on the client

[Email protected] ~]# CAT/ETC/RSYNCD.PASSWD

123qwe

chmod 600/etc/rsyncd.passwd

Uploading the client's files to the server

RSYNC-AVZL/ETC/PASSWD--password-file=/etc/rsyncd.passwd Test@192.168.100.102::backup/

Download the files on the server to the client

Rsync-avzl test@192.168.100.102::backup//tmp/--password-file=/etc/rsyncd.passwd


Linux system logs

/var/log/messages System Total Log

/etc/logrotate.conf Log Cutting configuration file

/VAR/LOG/DMESG System Hardware Information log

/var/log/secure Security log file (root password input error will be logged)


Last

View user information for the most recent login

[Email protected] logrotate.d]# last-3 #最近3次的信息

Root PTS/4 192.168.3.81 Mon Nov 6 15:08 still logged in

Root PTS/3 192.168.3.81 Mon Nov 6 14:44 still logged in

Root pts/0 192.168.3.81 Mon Nov 6 14:35 still logged in


Lastb

To view the user who failed to log on; the corresponding log file/var/log/btmp


Screen tool

Represents a virtual terminal that runs in the foreground

Keep a script running in the background without interrupting

Nohup./test.sh &


Installation:

Yum install-y Screen

[Email protected] rsync]# screen #直接进入一个bash

[[email protected] rsync] #ping www.baidu.com

Ctral a combo key and press D to exit the virtual terminal, but not the end

Screen-ls viewing the virtual terminal list

Screen-r ID into the specified terminal

[[email protected] rsync]# Screen-ls #Pts-1.test: expressed as a name, or you can customize it yourself

There is a screens on:

11496.pts-1.test(Detached)

1 Socket in/var/run/screen/s-root.


[Email protected] rsync]# Screen-r 11496

[Email protected] rsync]# screen-s Ping #直接指定名称

[Email protected] rsync]# screen-r Ping #进入


This article is from the "Discover new things" blog, make sure to keep this source http://shenj.blog.51cto.com/5802843/1979311

Rsync through service synchronization, Linux system logs, screen tools

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.