The Linux Letter: Getting in Rsync

Linux / Open Source
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

I've always been a believer in the philosophy of centralized file storage. For the user, a centralized file server provides a single place to find his files, which is particularly important if he tends to move from desk to desk via the Window's "Roaming Profiles" feature. For the administrator (read: you and I), a centralized server simplifies backup and maintenance. Once configured, the centralized server scenario provides a semblance of serenity for everyone. (Try to say that last sentence three times fast!) Unfortunately, laptop computers were dropped squarely in the middle of our tranquil pond of computing, causing a big splash and massive waves that continue to lap at its shores. Once laptops (and more recently PDAs and PMTs) came onto the scene, a method of synchronizing offline files with those on the file server became necessary, since the whole point of mobile computing is to allow mobility from the office and its server. What to do?

One solution available to Windows users is My Briefcase. This brute-force approach compares the timestamps of files contained within the Briefcase folder with their counterparts on the file server, ensuring that the newest version ends up in the appropriate place. I describe this feature as being "brute force" because, when compared with the topic of this month's article, it is. A more elegant solution is the rsync tool.

My Briefcase on Steroids

What makes rsync elegant? For starters, rsync uses an algorithm created by Andrew Tridgell (of Samba fame) that creates a diff (difference) between the two files being compared and transmits that diff instead of the entire file. While not terribly important for smaller files, this feature can yield a huge performance improvement while syncing large files over a dial-up or otherwise bandwidth-constrained connection. On top of this, rsync can compress the diff file for transmission, further enhancing the effect.

Rsync can do more than just synchronize files. It can synchronize entire directories. This feature can be used to produce mirrors between systems--such as a primary Web server and its backups. Similarly, I maintain a simple Web site on my laptop computer. When I'm ready to publish it, I run a script that invokes rsync. This is shown in Figure 1.


# The command line parameters are:
-a = use archive mode
 v = be verbose
    z = use compression on transfer
    e = specify rsh replacement (use ssh)
--delete = delete files on server missing on client
rsync -avze ssh --delete  --exclude 'CVS*' 
--exclude *~ 
--exclude '' 
--exclude '*.*sql' 
--exclude *xvpics* 


Figure 1: This simple script permits me to easily publish a Web site.

For securely syncing across a public network, rsync can use secure shell (ssh) as its transport. This ensures that the credentials used during the rsync initialization process can't be snooped.

Since it can perform its magic over directories, rsync is quite adept at being a backup solution for laptop computers. I have a script scheduled on my laptop that performs a backup on a nightly basis, copying the changed files to my desktop. Rsync will accept command line parameters (or parameters from a text file) that indicate which files or directories are to be included or excluded, so I can easily omit browser caches. If I want my backup to look like the current state of my laptop, I can instruct rsync to delete files on the server that are missing on the laptop. Alternatively, I can let deleted files live on the server.

I have just scratched the surface of what rsync can do. For a better picture of rsync's capabilities, visit the project Web site and check out the features page and the examples page.

Although developed primarily for *nix-like operating systems, rsync can run on Windows via the Cygwin environment (discussed last month) as well as on the iSeries under PASE. Cygwin and most distributions of Linux already include rsync. If you want the latest version (or you want to run it under PASE), you can point your browser to the rsync home page.

Rsync and iSeries

Running rsync under Cygwin or Linux is straightforward, but it's beyond the scope of this article. Running rsync on the iSeries requires a minimal amount of additional effort. The reason? Normally, an invocation of rsync from a client to a server causes the server to invoke a copy of rsync with which the copy running on the client will communicate. Using rsync on the iSeries requires a different technique. To successfully synchronize between an iSeries and any other platform, you'll need to run rsync in daemon mode. The additional effort I mentioned comes from having to create two additional files that will define the behavior of the rsync daemon. But before I discuss them, let me show you how to get rsync installed on your iSeries.


Installation on the iSeries involves the following steps:

1. Obtain the rsync program.

2. Load it onto the iSeries IFS.

3. Add some configuration files.

4. Run it.

Let's examine each of the steps in more detail now.

Step one is very easy to complete. The iSeries PASE enables you to run AIX binaries and, conveniently, rsync is available precompiled for AIX 4.5 from the rsync download page. Download the binary (which, at the time of this writing, is rsync-2.4.5.AIX43.tar.gz) and use FTP to transfer the file to a directory in the IFS of your iSeries (making sure you use the FTP "bin" directive when uploading the file).

Step two requires a few more gyrations. The file that you downloaded is a tape archive (tar) file and is compressed using gzip (as indicated by the tar.gz extension). This provides the first obstacle because it needs to be "gunzipped" prior to installation. Curiously, gunzip is not provided on my V4R5 edition of PASE (newer versions may have it); but, surprisingly, it is available using QSHELL. So, the first thing you must do is start a QSHELL session via the OS/400 command QSH or STRQSH. Once you are presented with a prompt ("$"), change to the directory in which you FTPed the file; then issue this command:

gunzip rsync-2.4.5.AIX43.tar.gz 

This creates the file rsync-2.4.5.AIX43.tar. This file is the tar file from which you'll do the installation. All of this is shown in Figure 2.

Figure 2: These steps result in a tar file usable from PASE. (Click images to enlarge.)

Next, end the QSHELL session by pressing F3; then, start a PASE session from an OS/400 session by typing this command:

call qp2term

As a matter of course, I tend to place files that I am adding to an existing system in the /opt directory. This makes it easier to maintain or remove them later. I use the following command to make the directory into which I'm going to install rsync:

mkdir -p /opt/rsync

I then make that directory the current directory by issuing this command:

cd /opt/rsync 

Finally, I extract the binaries by issuing this command:

tar -xf /home/klinebl/rsync-2.4.5.AIX43.tar 

A quick ls command confirms the success of the operation.

Now, create a symbolic link from the rsync binary into the /usr/bin directory so that it can be run without providing the complete path name. This is accomplished via cd /usr/bin followed by the command ln -sf /opt/rsync/bin/rsync. All of this is shown in Figure 3. Please note that the tar file also includes the manual pages. You can delete those with the command rm -rf /opt/rsync/man, since PASE doesn't include the *nix manual reader.

Figure 3: This screen shows the command that will provide you with a working rsync client on the iSeries.

At this point, you have an active rsync installation that requires only the addition of two configuration files. The first, /etc/rsyncd.conf, contains the configuration information that rsync uses when in daemon mode. The second, /etc/rsyncd.scrt, contains authentication information. These are shown in Figure 4, along with comments about the entries.

------ /etc/rsyncd.conf ---------
# This is the file that rsync will log to.  Useful
# for debugging your configuration!
log file = /usr/local/rsync/rsync.log

# The next line defines what could be called a "share."
path = /home/klinebl
comment = My server
# The uid and gid are UserID and GroupID.  The iSeries
# has both. This will be the owner of the files rsynced
# for this share
uid = klinebl
gid = klinebl
# Allow bi-directional synchronization.
read only = no
list = yes
# The authorized users for this share.  They need
# to be listed in the /etc/rsyncd.scrt file
auth users = klinebl
# File for authentication of this share
secrets file = /etc/rsyncd.scrt

------ /etc/rsyncd.scrt ---------
# Note that the users listed here aren't necessarily
# "real" users on your iSeries.


Figure 4: The contents of the configuration files for rsync are shown here. This is an extremely simple example.

I created these files on my Linux machine and used FTP to transfer them to the /etc directory on my iSeries. You could do the same thing via the Windows Notepad utility. The full documentation on the configuration files is available on your Linux box (if you have one) via man rsyncd.conf. Alternately, the docs are available on the Web Site.

Step four is simply to run the command to start rsync. From the qp2term command session, issue this command:

rsync --daemon 

If things are working properly, you should be returned to a command line. To verify that the program is really running, switch to an OS/400 command line and type netstat. From the menu presented, select option 3 (Work with TCP/IP connection status); then, scroll down until you find a listener on port 873. That's rsync awaiting your command.

Final Check and Check Out

When everything is up and running, you can check out your installation by running the following command from the qp2term session:

 rsync localhost:: 

If you are successful, you should see a screen that looks something like Figure 5. Obviously, the values that you provide in your rsyncd.conf file will determine the results you see from this test.

Figure 5: This is the result of a successful installation.

In this article, I given you instructions on how to perform a basic setup on your iSeries, since this is non-intuitive and not specifically mentioned in the documentation. There are far too many different combinations of client/servers and too many scenarios for which rsync can be utilized for me to describe them all. Your best bet is to visit the rsync Web site and nose around. Once you get started, you'll find rsync to be an invaluable tool.

Barry L. Kline is a consultant and has been developing software on various DEC and IBM midrange platforms for over 20 years. Barry discovered Linux back in the days when it was necessary to download diskette images and source code from the Internet. Since then, he has installed Linux on hundreds of machines, where it functions as servers and workstations in iSeries and Windows networks. He recently co-authored the book Understanding Linux Web Hosting with Don Denoncourt. Barry can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

Barry Kline

Barry L. Kline is a consultant and has been developing software on various DEC and IBM midrange platforms since the early 1980s. Barry discovered Linux back in the days when it was necessary to download diskette images and source code from the Internet. Since then, he has installed Linux on hundreds of machines, where it functions as servers and workstations in iSeries and Windows networks. He co-authored the book Understanding Web Hosting on Linux with Don Denoncourt. Barry can be reached at



Support MC Press Online





  • White Paper: Node.js for Enterprise IBM i Modernization

    SB Profound WP 5539

    If your business is thinking about modernizing your legacy IBM i (also known as AS/400 or iSeries) applications, you will want to read this white paper first!

    Download this paper and learn how Node.js can ensure that you:
    - Modernize on-time and budget - no more lengthy, costly, disruptive app rewrites!
    - Retain your IBM i systems of record
    - Find and hire new development talent
    - Integrate new Node.js applications with your existing RPG, Java, .Net, and PHP apps
    - Extend your IBM i capabilties to include Watson API, Cloud, and Internet of Things

    Read Node.js for Enterprise IBM i Modernization Now!


  • Profound Logic Solution Guide

    SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation.
    Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects.
    The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the companyare not aligned with the current IT environment.

    Get your copy of this important guide today!


  • 2022 IBM i Marketplace Survey Results

    Fortra2022 marks the eighth edition of the IBM i Marketplace Survey Results. Each year, Fortra captures data on how businesses use the IBM i platform and the IT and cybersecurity initiatives it supports.

    Over the years, this survey has become a true industry benchmark, revealing to readers the trends that are shaping and driving the market and providing insight into what the future may bring for this technology.

  • Brunswick bowls a perfect 300 with LANSA!

    FortraBrunswick is the leader in bowling products, services, and industry expertise for the development and renovation of new and existing bowling centers and mixed-use recreation facilities across the entertainment industry. However, the lifeblood of Brunswick’s capital equipment business was running on a 15-year-old software application written in Visual Basic 6 (VB6) with a SQL Server back-end. The application was at the end of its life and needed to be replaced.
    With the help of Visual LANSA, they found an easy-to-use, long-term platform that enabled their team to collaborate, innovate, and integrate with existing systems and databases within a single platform.
    Read the case study to learn how they achieved success and increased the speed of development by 30% with Visual LANSA.


  • Progressive Web Apps: Create a Universal Experience Across All Devices

    LANSAProgressive Web Apps allow you to reach anyone, anywhere, and on any device with a single unified codebase. This means that your applications—regardless of browser, device, or platform—instantly become more reliable and consistent. They are the present and future of application development, and more and more businesses are catching on.
    Download this whitepaper and learn:

    • How PWAs support fast application development and streamline DevOps
    • How to give your business a competitive edge using PWAs
    • What makes progressive web apps so versatile, both online and offline



  • The Power of Coding in a Low-Code Solution

    LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks



  • Why Migrate When You Can Modernize?

    LANSABusiness users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
    In this white paper, you’ll learn how to think of these issues as opportunities rather than problems. We’ll explore motivations to migrate or modernize, their risks and considerations you should be aware of before embarking on a (migration or modernization) project.
    Lastly, we’ll discuss how modernizing IBM i applications with optimized business workflows, integration with other technologies and new mobile and web user interfaces will enable IT – and the business – to experience time-added value and much more.


  • UPDATED: Developer Kit: Making a Business Case for Modernization and Beyond

    Profound Logic Software, Inc.Having trouble getting management approval for modernization projects? The problem may be you're not speaking enough "business" to them.

    This Developer Kit provides you study-backed data and a ready-to-use business case template to help get your very next development project approved!

  • What to Do When Your AS/400 Talent Retires

    FortraIT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators is small.

    This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:

    • Why IBM i skills depletion is a top concern
    • How leading organizations are coping
    • Where automation will make the biggest impact


  • Node.js on IBM i Webinar Series Pt. 2: Setting Up Your Development Tools

    Profound Logic Software, Inc.Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. In Part 2, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Attend this webinar to learn:

    • Different tools to develop Node.js applications on IBM i
    • Debugging Node.js
    • The basics of Git and tools to help those new to it
    • Using as a pre-built development environment



  • Expert Tips for IBM i Security: Beyond the Basics

    SB PowerTech WC GenericIn this session, IBM i security expert Robin Tatam provides a quick recap of IBM i security basics and guides you through some advanced cybersecurity techniques that can help you take data protection to the next level. Robin will cover:

    • Reducing the risk posed by special authorities
    • Establishing object-level security
    • Overseeing user actions and data access

    Don't miss this chance to take your knowledge of IBM i security beyond the basics.



  • 5 IBM i Security Quick Wins

    SB PowerTech WC GenericIn today’s threat landscape, upper management is laser-focused on cybersecurity. You need to make progress in securing your systems—and make it fast.
    There’s no shortage of actions you could take, but what tactics will actually deliver the results you need? And how can you find a security strategy that fits your budget and time constraints?
    Join top IBM i security expert Robin Tatam as he outlines the five fastest and most impactful changes you can make to strengthen IBM i security this year.
    Your system didn’t become unsecure overnight and you won’t be able to turn it around overnight either. But quick wins are possible with IBM i security, and Robin Tatam will show you how to achieve them.

  • Security Bulletin: Malware Infection Discovered on IBM i Server!

    SB PowerTech WC GenericMalicious programs can bring entire businesses to their knees—and IBM i shops are not immune. It’s critical to grasp the true impact malware can have on IBM i and the network that connects to it. Attend this webinar to gain a thorough understanding of the relationships between:

    • Viruses, native objects, and the integrated file system (IFS)
    • Power Systems and Windows-based viruses and malware
    • PC-based anti-virus scanning versus native IBM i scanning

    There are a number of ways you can minimize your exposure to viruses. IBM i security expert Sandi Moore explains the facts, including how to ensure you're fully protected and compliant with regulations such as PCI.



  • Encryption on IBM i Simplified

    SB PowerTech WC GenericDB2 Field Procedures (FieldProcs) were introduced in IBM i 7.1 and have greatly simplified encryption, often without requiring any application changes. Now you can quickly encrypt sensitive data on the IBM i including PII, PCI, PHI data in your physical files and tables.
    Watch this webinar to learn how you can quickly implement encryption on the IBM i. During the webinar, security expert Robin Tatam will show you how to:

    • Use Field Procedures to automate encryption and decryption
    • Restrict and mask field level access by user or group
    • Meet compliance requirements with effective key management and audit trails


  • Lessons Learned from IBM i Cyber Attacks

    SB PowerTech WC GenericDespite the many options IBM has provided to protect your systems and data, many organizations still struggle to apply appropriate security controls.
    In this webinar, you'll get insight into how the criminals accessed these systems, the fallout from these attacks, and how the incidents could have been avoided by following security best practices.

    • Learn which security gaps cyber criminals love most
    • Find out how other IBM i organizations have fallen victim
    • Get the details on policies and processes you can implement to protect your organization, even when staff works from home

    You will learn the steps you can take to avoid the mistakes made in these examples, as well as other inadequate and misconfigured settings that put businesses at risk.



  • The Power of Coding in a Low-Code Solution

    SB PowerTech WC GenericWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks



  • Node Webinar Series Pt. 1: The World of Node.js on IBM i

    SB Profound WC GenericHave you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.
    Part 1 will teach you what Node.js is, why it's a great option for IBM i shops, and how to take advantage of the ecosystem surrounding Node.
    In addition to background information, our Director of Product Development Scott Klement will demonstrate applications that take advantage of the Node Package Manager (npm).
    Watch Now.

  • The Biggest Mistakes in IBM i Security

    SB Profound WC Generic The Biggest Mistakes in IBM i Security
    Here’s the harsh reality: cybersecurity pros have to get their jobs right every single day, while an attacker only has to succeed once to do incredible damage.
    Whether that’s thousands of exposed records, millions of dollars in fines and legal fees, or diminished share value, it’s easy to judge organizations that fall victim. IBM i enjoys an enviable reputation for security, but no system is impervious to mistakes.
    Join this webinar to learn about the biggest errors made when securing a Power Systems server.
    This knowledge is critical for ensuring integrity of your application data and preventing you from becoming the next Equifax. It’s also essential for complying with all formal regulations, including SOX, PCI, GDPR, and HIPAA
    Watch Now.

  • Comply in 5! Well, actually UNDER 5 minutes!!

    SB CYBRA PPL 5382

    TRY the one package that solves all your document design and printing challenges on all your platforms.

    Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product.

    Request your trial now!

  • Backup and Recovery on IBM i: Your Strategy for the Unexpected

    FortraRobot automates the routine tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:
    - Simplified backup procedures
    - Easy data encryption
    - Save media management
    - Guided restoration
    - Seamless product integration
    Make sure your data survives when catastrophe hits. Try the Robot Backup and Recovery Solution FREE for 30 days.

  • Manage IBM i Messages by Exception with Robot

    SB HelpSystems SC 5413Managing messages on your IBM i can be more than a full-time job if you have to do it manually. How can you be sure you won’t miss important system events?
    Automate your message center with the Robot Message Management Solution. Key features include:
    - Automated message management
    - Tailored notifications and automatic escalation
    - System-wide control of your IBM i partitions
    - Two-way system notifications from your mobile device
    - Seamless product integration
    Try the Robot Message Management Solution FREE for 30 days.

  • Easiest Way to Save Money? Stop Printing IBM i Reports

    FortraRobot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing.
    Manage your reports with the Robot Report Management Solution. Key features include:

    - Automated report distribution
    - View online without delay
    - Browser interface to make notes
    - Custom retention capabilities
    - Seamless product integration
    Rerun another report? Never again. Try the Robot Report Management Solution FREE for 30 days.

  • Hassle-Free IBM i Operations around the Clock

    SB HelpSystems SC 5413For over 30 years, Robot has been a leader in systems management for IBM i.
    Manage your job schedule with the Robot Job Scheduling Solution. Key features include:
    - Automated batch, interactive, and cross-platform scheduling
    - Event-driven dependency processing
    - Centralized monitoring and reporting
    - Audit log and ready-to-use reports
    - Seamless product integration
    Scale your software, not your staff. Try the Robot Job Scheduling Solution FREE for 30 days.