Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Rsync installation Test, a tool for remote File transfer and replication in AIX Environment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

A brief introduction to RSYNC

   rsync (remote synchronize) is a remote data synchronization tool that allows you to quickly synchronize files between multiple hosts through LAN/WAN. Rsync uses the so-called "rsync algorithm" to synchronize files between local and remote hosts. This algorithm transfers only different parts of the two files, rather than the whole file each time, so it is quite fast.

The basic features of    rsync are as follows: 1. You can mirror and save the entire directory tree and file system; 2. It is easy to maintain the permissions, time, soft and hard links of the original file, etc. It can be installed without special permission; 4. Optimized process, high efficiency of file transfer; 5. You can use rsh, ssh and other methods to transfer files, of course, you can also use a direct socket connection; 6. Anonymous transmission is supported.

Second, Openssh installation 1. Download software

Openssl download: https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=aixbp&S_PKG=openssl&lang=en_US

Openssh download: http://sourceforge.net/projects/openssh-aix

Download the software: openssl-0.9.8.1302.tar.Z and openssh_5.4p1.tar.z

two。 Install openssh

Generally, openssl is installed first and then openssh. Install openssl and openssh through smit install, enter the path to the installation file below, and choose to accept the new license agreement.

3. Check the installation package

After installing ssl and ssh, the installation package is as follows:

Ssh: openssh.base.client 、 openssh.base.server 、 openssh.license 、 openssh.man.en_US 、 openssh.msg.en_US

Ssl: openssl.license 、 openssl.man.en_US 、 openssl.base

4. Restart the service tppc01:/ # stopsrc-s sshd0513-044 The sshd Subsystem was requested to stop.tppc01:/ # startsrc-s sshd0513-059 The sshd Subsystem has been started. Subsystem PID is 1581116.tppc01:/ # ssh-VOpenSSH_5.4p1, OpenSSL 0.9.8m 25 Feb 2010

Third, RSYNC installation 1. Install the rsync package

Download the installation packages port and rsync:

Popt-1.7-2.aix5.1.ppc.rpm

Rsync-2.6.2-1.aix5.1.ppc.rpm

The link is:

Ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/rsync/rsync-2.6.2-1.aix5.1.ppc.rpm ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/rpm/popt-1.7-2.aix5.1.ppc.rpm

Install the package with smitty and place the package in the / tmp/rsync directory as follows:

two。 Server-side configuration

The server side is the source side (172.27.34.237), and the source side configuration files are mainly rsyncd.conf (main configuration file), rsyncd.pwd (password file) and rsyncd.motd (rsync server information). Create a new rsync directory under / etc and enter / etc/rsync new configuration files rsyncd.conf, rsyncd.pwd, rsyncd.motd.

The rsyncd.conf content is as follows:

Rsyncd.conf is the main configuration file for the rsync server, which does not exist by default and needs to be created manually.

Uid=rootgid=system#max connections=4use chroot=truelog file=/var/log/rsyncd.logpid file=/var/run/rsyncd.pidmotd file=/etc/rsync/ rsyncd.motd#lock file=/var/run/rsyncd.lock#auth users=rootsecrets file=/etc/rsync/rsyncd.pwdtransfer logging = true#port = 873#limit access to private LANshosts allow=172.27.34.238#hosts deny=* [rsync] path=/home/rsynccomment = home rsync # ignore errorsread only = yeslist = yes auth users=rootsecrets file=/etc/rsync/rsyncd.pwd

The rsyncd.pwd content is as follows:

Rsyncd.pwd is a password file, the format is: user:password; this user must exist in the system, and the password is the rsync synchronization password, which can be different from the system password, and the server can be consistent with the client; in order to ensure the security of the password, the password file permission should be set to 600. the owner is root.

The content of rsyncd.motd is:

+ Welcome to use the Location A To Location B rsync services! 2018-2019 +

Rsyncd.motd defines the rysnc server information, that is, the user login information. For example, let the user know who provided the server; similar to the prompt we see when the ftp server logs in. When defining variables globally, it is not necessary.

3. Client configuration

Note: the client password file format is different from the server side, and the password file permission attribute is owner readable.

4. Start the rsync service

Server side:

Start the rsync process

/ usr/bin/rsync-daemon-config=/etc/rsync/rsyncd.conf

This service item will not be started, and the service needs to be started after the server machine is restarted.

Check to see if the service is started and view the process:

Ps-ef | grep rsync

Check the port (rsync default port is 873, port snooping certificate service is pulled):

Netstat-an | grep 873

The above is the normal procedure to start normally.

Client:

Rsync-vzrtopg-progress-delete-exclude "diff_bak/"-password-file=/etc/rsync/rsyncd.pwd root@172.27.34.237::rsync / home/rsync

In order to ensure timing synchronization, client synchronization commands can be written in the form of timing tasks.

4. Detailed explanation of configuration information 1. Server-side definition

Global definition

Parameters indicate which user and user group to send when transferring files on the uid=root server. By default, which user and user group should be sent when transferring files on the nobodygid=system server. The default is the maximum number of nobodymax connections=4 client connections. Before transferring files, the server daemon will chroot to the directory in the file system. The advantage of this is that the system may be protected from installation vulnerabilities. The disadvantage is that superuser privileges are required. In addition, symbolic link files will be excluded. That is to say, if you have a symbolic link on the rsync server, when you run the synchronization data of the client on the backup server, you will only synchronize the symbolic link name, not the content of the symbolic link. The log of the log file=/var/log/rsyncd.logrsync server pid file=/var/run/rsyncd.pid tells the process to write to the / var/run/rsyncd.pid file motd file=/etc/rsync/rsyncd.motd to define the motd file path. Rsyncd.motd content defines server information. Users will see this information when logging in. Transfer logging = true transfer file log port = 873 specify the running port. The default is 873. You can specify your own hosts allow=172.27.34.238, you can specify a single IP, or you can specify the entire network segment, which can improve security. The format is between ip and ip, between ip and network segment, and between network segment and network segment with a space read only = yes read-only choice, so that the client is not allowed to upload files to the server.

Module definition

Parameter description [rsync] module name. The main purpose is to define which directory of the server will be synchronized. Each module is in the form of [name]. This is the name you saw on the rsync client. The data that the server actually synchronizes is specified through path. We can specify multiple modules according to our own needs. Each module specifies the authenticated user, password file, but not required path=/home/rsync specifies the path to the file directory comment = home rsync comment. The content of the comments can be defined by yourself, prompting ignore errors to ignore IO errors exclude = beinan/ samba/ to exclude beinan and samba under the / home directory, there is a space between beinan/ and samba/ directories list = yeslist means to list whether the directory providing synchronous data on the rsync server is displayed on the server. The default is yes. If you don't want to list it, no it; if no is more secure, at least others don't know which directories are available on your server. You know the auth users = root authentication user is root, the user must exist on the server, if you want to use multiple users, you need to separate, such as auth users = root,user1secrets file=/etc/rsync/rsyncd.pwd password file save path 2. Client definition

Rsync command format:

1.rsync [OPTION]... SRC [SRC]... [USER@] HOST:DEST2.rsync [OPTION]... [USER@] HOST:SRC DEST3.rsync [OPTION]... SRC [SRC]... DEST4.rsync [OPTION]... [USER@] HOST::SRC [DEST] 5.rsync [OPTION]... SRC [SRC]... [USER@] HOST::DEST6.rsync [OPTION]... Rsync:// [USER@] HOST [: PORT] / SRC [DEST]

Rsync has six different modes of operation:

1. Copy local files; start this working mode when neither SRC nor DES path information contains a single colon: delimiter. two。 Use a remote shell program (such as rsh, ssh) to copy the contents of the local machine to the remote machine. Start this mode when the DST path address contains a single colon ":" separator. 3. Use a remote shell program (such as rsh, ssh) to copy the contents of the remote machine to the local machine. Start this mode when the SRC address path contains a single colon ":" separator. 4. Copy files from a remote rsync server to the local machine. This mode is started when the SRC path information contains the "::" delimiter. 5. Copy files from the local machine to the remote rsync server. This mode is started when the DST path information contains the "::" delimiter. 6. List the files for the remote machine. This is similar to rsync transport, except that the local machine information is omitted from the command.

Parameters in rsync:

Parameter description-an operates in archive mode, copies directories, symbolic links are equivalent to-rlptgoD-r recursion-l is a linked file It means to copy the linked file-p means to keep the original permissions of the file-t keep the original time of the file-g keep the original user group of the file-o keep the original owner of the file-D is equivalent to the block device file-P transfer progress-v transfer progress and other information-the parameters of essh establish an encrypted connection-u is only updated to prevent new local files from being rewritten Note the synchronization of the clocks of the two machines-- progress means showing detailed progress-- delete means that if the server deletes the file, the client deletes the file accordingly, keeping it truly consistent-- password-file=/password/path/file specifies the password file so that it can be used in scripts without having to enter the authentication password interactively. It should be noted here that the permission attribute of this password file should be set to be readable only by the owner.

All scripts and configuration files in this article have been uploaded: rsync installation test, a tool for remote file transfer and replication in AIX environment.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report