Home / Linux

Category: Linux

Configure rsync as a daemon

Typically, the rsync tool operates through the secure shell (SSH) protocol when synchronizing files between a client on a local system and a host situated remotely. Nevertheless, there is an alternative to execute it as a daemon if the user prefers not to utilize the ssh protocol. Due to the absence of encryption in the …

Read more

SELinux context is not preserved during rsync

The preservation of SELinux context is not maintained during a rsync operation due to the absence of the xattr feature on the target NFS file system. Running rsync with the options -X does not preserve SELinux context and observes apparent errors such as ** security.selinux failed: Operation not supported. Method 1 - Utilize the tar …

Read more

Why are scripts under /etc/sysconfig/network-scripts directory are gone on AlmaLinux 8/AlmaLinux 9?

Some of the issues faced by system engineers are; Why are files in /etc/sysconfig/network-scripts ignored? Where are interface configs now? I changed a config in an ifcfg-file in directory /etc/sysconfig/network-scripts. Why does the system ignore these changes? A configuration file for each interface should be placed in either the /etc/NetworkManager/system-connections or the /etc/sysconfig/network-scripts directory for …

Read more

How to backup old files before override them in rsync?

How to back up the old files on the target server before rsync replaces them with new ones? Use --backup option in rsync. For instance, # rsync -a --backup --backup-dir="/version2" /var/log/ root@192.168.122.246:/var-log-bk/ This command will copy files from local /var/log to root@192.168.1.100:/var-log-bk/ if rsync overrides some files in 192.168.1.100:/var-log-bk/. It will back up those files …

Read more

How to avoid password prompt input with rsync?

You are given a password input prompt when transferring files to a different server with rsync. $ rsync -avz /data root@srv::files Password: There are two ways to use the RSYNC_PASSWORD environment variable and the --password-file option. Using the environment variable $ export RSYNC_PASSWORD=secret $ rsync -avz /data root@srv::files or $ RSYNC_PASSWORD=secret rsync -avz /data root@srv::files …

Read more

How to avc_cache_threshold persistently in CentOS?

The current runtime is set by the following command. # echo 8192 > /sys/fs/selinux/avc/cache_threshold If you want to keep this change, you can run the two commands below to add them to startup. # echo "echo 8192 > /sys/fs/selinux/avc/cache_thresshold" >> /etc/rc.d/rc.local # chmod +x /etc/rc.d/rc.local   Purchase Dedicated Servers Select, configure, and buy! Click Here

Read more

Why CentOS ignore packets when the route for outbound traffic differs from the route of incoming traffic?

To resolve this issue, set the net.ipv4.conf.all.rp_filter kernel tunable parameter value to 2. sysctl -w net.ipv4.conf.all.rp_filter=2 To make this change persistent across reboots, add the tunable to the /etc/sysctl.conf file. Strict filtering means that when a packet comes into the system, the kernel looks up the source IP in its routing table to see if …

Read more

How to exclude more than one directory with rsync?

To exclude a directory with rsync, use -av and -e. # rsync -av -e --exclude='/path/' ip:/path/to/destination To exclude multiple directories with rsync, use -av and -e again. # rsync -av -e --exclude='/path/to/file' --exclude='/path2/*' ip:/path/to/destination Purchase Dedicated Servers Select, configure, and buy! Click Here

Read more

How to view the progress of an rsync job?

If you are running an rsync job that is backing up large amounts of data, you may want to make sure everything is proceeding normally by being able to view the progress of the rsync job. You need to add the progress option using either method. (--progress or -P) ~]# rsync -a --progress /tmp/ backup/ …

Read more

How to install an RPM package into a different directory?

A relocatable RPM package can change its installation path during the setup process. Not all RPM packages can be installed into a custom directory. Use the following command to see if a specific package can be relocated. # rpm -qpi <rpm package> | grep Relocations To check rpm packages, centos-lsb-1.3-3.1.EL3.i386.rpm and rsync-2.5.7-5.3E.i386.rpm: # rpm -qpi …

Read more

How to use setroubleshoot to get solution for AVC messages?

Install setroubleshoot-server as follows. # yum install -y setroubleshoot-server If the system is in enforcing or permissive mode, setroubleshoot will provide a user-friendly explanation about the AVC's. When there's AVC denial, messages like those below will print to /var/log/messages. Jul 14 09:52:03 desktop setroubleshoot: SELinux is preventing 57656220436F6E74656E74 from write access on the file firefox52.pdf. …

Read more