Centos /Cloudlinux 7 error restarting a systemd service

Unable to register authentication agent

** (pkttyagent:478736): WARNING **: 18:16:34.777: Unable to register authentication agent: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject Error registering authentication agent: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject (polkit-error-quark, 0)

# groupadd -g 23 nohidproc
# usermod -a -G nohidproc polkitd
# mount -o remount,rw,hidepid=2,gid=nohidproc /proc
# systemctl restart polkit

 

 

nano /etc/fstab
# comment the following line :
from : proc /proc proc defaults,hidepid=2 0 0
to : # proc /proc proc defaults,hidepid=2 0 0
# add the following line
proc /proc proc defaults,hidepid=2,gid=nohidproc 0 0

Add MX Record with Custom Priority for Plesk

/sbin/plesk bin dns -a abc.com -mx "" -mailexchanger mail.abc.com -priority 1

Fix the glibc error at boot

Environment: Centos 7 Boot Process

Error : System Hanging at “Starting Switch Root”,Boot fails.

Solution: Replace/Reinstall glibc-x.x.x.el7.x86.64 package after boot your server with centos rescue dvd / cd / iso image

rpm -ivh –root=/mnt/sysimage –replacefiles –replacepkgs /run/install/repo/Packages/glibc-x.x.x.el7.x86.64.rpm

Imunify360 enable malware cleanup for all users

One line script for enable malware cleanup for all users.It can be used as batch script for every feature those can be applied only user basis.

Other command line options described here

for i in $(awk -F: ' $3 >= 10000 {print $1}' /etc/passwd); do imunify360-agent feature-management enable --feature av --users $i; done

Delete command history with last command

this command will remove commands history  with itself in an given offset as well

for h in $(seq 1968 1975); do history -d 1968; done; history -d $(history 1 | awk '{print $1}')

Connect to android device screen from ubuntu pc

Scrcpy is a software to connect to your android device (phone or tablet) from your ubuntu pc.

It is really fast and stable.All you have to do is install the software with using apt

$ sudo apt install scrcpy

and then connect your android device to your pc via usb cable.Enable adb usb debugging.and run the tool

$ scrcpy
INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 7.9 MB/s (24773 bytes in 0.003s)
INFO: Initial texture: 1080x1920

and Thumbs up! they really made a good software.I appreciate.Thanks to Genymobile!

Github page https://github.com/Genymobile/scrcpy

List access or error log files with their sizes plesk hosting servers

List all access log files;

find /var/www/vhosts/*/logs/error_log -exec ls -la {} \; | awk '{print $5 " " $9}' | sort -n

List all error log files;

find /var/www/vhosts/*/logs/access_log -exec ls -la {} \; | awk '{print $5 " " $9}' | sort -n

For access logs,there are also other access log files in that directory.For example,access_ssl_log,access_ssl_log.processed and more.So to list all files that starts with access,use wildcards like;

find /var/www/vhosts/*/logs/access* -exec ls -la {} \; | awk '{print $5 " " $9}' | sort -n

Unable to change hosting php version in php selector for Cloudlinux

In this case,problem is file permissions for php.ini file related that you want to switch php version.

Login to shell and change the group owner of related file.Sample command is for php 7.4

chgrp linksafe /opt/alt/php74/etc/php.ini

Change compression type for Plesk backups

As a new feature,Plesk picked up zstd compression method for backups.If you want to create backup files with classic method you can edit the panel.ini file in two way

1. Go to Extensions ->Install and activate panel editor extension and open the editor in my extensions section

Select the editor and add these;

[pmm]
compressionMethod = deflate

2.Login to shell.Open /usr/local/psa/admin/conf/panel.ini file with your favorite editor like nano or vi.Add theses line to the appropriate place

[pmm]
compressionMethod = deflate

Note.You may already see [pmm] section.In this case you just add compressionMethod = deflate

below the [pmm] section.