Posts

centos change ssh port

in this tutorial, How to change ssh port another with selinux. The default ssh port 22, when you change port another with rules selinux (SELINUX=enforcing) get error can't change ssh port. Solve problem!( Running command following with root account) File selinux with content SELINUX=enforcing as below: [huupv@huupv ~]$ sudo cat /etc/sysconfig/selinux [sudo] password for huupv: # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: #     enforcing - SELinux security policy is enforced. #     permissive - SELinux prints warnings instead of enforcing. #     disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of these three values: #     targeted - Targeted processes are protected, #     minimum - Modification of targeted policy. Only selected processes are protected. #     mls - Multi Level Security protection. SELINUXTYPE=targeted How do it... Step 1 : Open sshd_config file # vi /etc/

Centos 7 managing services with Systemd

Centos 7 managing services with Systemd. -List all the current loaded targets as command below: $ sudo systemctl list-units -t target Each services has 3 states; enabled, disabled and static. - To list enabled services as command below: $ sudo systemctl list-unit-files --type=service | grep enabled - To start/stop/restart services as command below: # systemctl status <servicename> # systemctl stop <servicename> # systemctl start <servicename> # systemctl restart <servicename> - To check running ntp services as comman below: $ sudo systemctl list-units --type service --all | grep ntp - Set the service to start a boot: # systemctl enable <servicename> - Disable service start-up boot # systemctl disable service The update later related command line "Centos 7 managing services with Systemd" in this article.

Bash script Change folder Permissions Recursively

Image
In my post, How to use Bash script Change to folder Permissions Recursively. For example, To change all folder and file under huuphan.com folder. To list tree file and folder under huuphan.com folder [root@huupv huupv]# tree huuphan.com/ huuphan.com/ ├── a │   ├── abc.txt │   └── b │       └── c └── K 4 directories, 1 file To use find command list all file and folder under huuphan.com folder [root@huupv huupv]# find /home/huupv/huuphan.com -type d -exec ls -ld {} + >chown_folder.txt To use cat command read chown_folder.txt file [root@huupv huupv]# cat chown_folder.txt  The content in chown_folder.txt file file as below: drwxrwxr-x. 4 huupv huupv 4096 Mar  9 22:38 /home/huupv/huuphan.com drwxrwxr-x. 3 huupv huupv 4096 Mar  9 22:38 /home/huupv/huuphan.com/a drwxrwxr-x. 3 huupv huupv 4096 Mar  9 22:37 /home/huupv/huuphan.com/a/b drwxrwxr-x. 2 huupv huupv 4096 Mar  9 22:37 /home/huupv/huuphan.com/a/b/c drwxrwxr-x. 2 huupv huupv 4096 Mar  9 22:38 /home

List the contents of tar gz file

tar command is archiving utility. Something, you can retrieve extension .tar.gz or .tar.bz2 file. How to list the contents this without extracting from command line. The syntax tar command as below: tar OPTION File_Name With OPTION : t, --list : List the contents of an archive v : Verbosely list files processed j : Filter archive through bzip2 f : filename  You may reading link as below: Iptables how to How to reset password on centos 7 Bash script example List the contents of .tar.gz file To use tar command for .tar.gz as following: $ tar -tvf links-2.12.tar.gz  The output of links-2.12.tar.gz file as below: -rwxr--r-- 1000/1000      1215 2001-10-05 14:03 links-2.12/mailcap.pl -rwxr-xr-- 1000/1000      4654 2015-06-28 22:13 links-2.12/rebuild -rw-r--r-- 1000/1000       461 2003-05-06 01:10 links-2.12/links_16x16_1.xpm -rw-r--r-- 1000/1000      2410 2003-05-06 01:10 links-2.12/links_32x32.xpm -rw-r--r-- 1000/1000      3847 2005-03-01 00:16 links-2.12/links-48x48.xpm -

List top sender address emails in zimbra

How to List top sender address emails in zimbra from command line. From MTA zimbra I will run command to list 6 sender address email Zimbra . The command as below: $ cat /var/log/zimbra.log | awk -F 'from=<' '{print $2}' | awk -F'>' '{print $1}' | sed '/^$/d' | sort | uniq -c | sort -nk1 -r | sed -n '1,6p' Note: sed '/^$/d' : To delete only blank lines sed -n '1,6p' : To print 1 line to 6 line. awk -F 'from=<' '{print $2}' | awk -F'>' '{print $1}' : To print the email of sender address Conclusion Thought the article, To help you list top sender address emails in zimbra. if you any question then command below

How to zimbra add account to distribution list

Image
In this tutorial, How do I use zimbra add account to distribution list by bash script. I’m written bash script for add account to distribution list. You may reading link as below: zimbra some service are not running How to install and configure zimbra multi server How to Restrict Sending to Distribution list in zimbra mail Zimbra add account to distribution list The syntax, create distribution lists command line from root account su - zimbra -c "zmprov adlm [email protected] [email protected]" My bash script for zimbra add account to distribution list as below: #!/bin/bash #Author: HuuPV #Add member to DL echo -n "Input distribute name, pls (Ex: [email protected]): " read DL echo -n "Input account add to distribute name, pls (Ex: [email protected]): " read AC Check_Member_DL=$(su - zimbra -c "zmprov gdl $DL | grep '\b$AC'") if [ $? == 0 ] then        echo "$AC membe

How to zimbra auto create distribution lists

Image
In this tutorial, How to zimbra auto create distribution list by bash script. I’m written bash script for create distribution list. Step 1: To check distribution lists name exists or not! Step 2: To create distribution lists from file. Step 3: Running zimbra auto create distribution lists bash script from root account. You may reading link as below: zimbra some service are not running How to install and configure zimbra multi server How to Restrict Sending to Distribution list in zimbra mail zimbra auto create distribution lists The syntax create distribution lists command line from root account su - zimbra -c "zmprov cdl [email protected]" To create distribution lists from file. For example, I’m created list_distribute.txt in /tmp folder as below: Zimbra auto create distribution lists full script. Bash script for distribution lists name as below: [root@mail opt]# cat zimbra_Distribute.sh The content zimbra_Distribute.sh as below: #!/bin/bash # Auth

zimbra 451 4.3.5 Server configuration problem [solved problem]

You getting this error " zimbra 451 4.3.5 Server configuration problem" in zimbra.log. How to this is solved problem. You may reading link as below: zimbra some service are not running How to install and configure zimbra multi server How to Restrict Sending to Distribution list in zimbra mail zimbra 451 4.3.5 Server configuration problem The log error as below: Jan 22 11:31:36 mta postfix/smtpd[9984]: NOQUEUE: reject: RCPT from unknown[198.54.114.232]: 451 4.3.5 Server configuration problem; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<HuuPV> How I do it.... The first To increase RAM, CPU for your zimbra system. For example, if your zimbra system  size medium and larger. To increase >= 16GB RAM and >= 8 CPU for zimbra MTA system. The second To configure cbpolicyd.conf.in file with parameter min_servers, min_spare_servers, max_spare_servers, max_servers, max_requests the appropriate for your zimbra system configu

zimbra create multiple accounts csv file

I will writing the script for create multiple accounts from csv file. To create Accounts.csv file To use bash script create multiple accounts in zimbra To execute zimbra_account.sh bash script I'm created Accounts.csv file # cat Accounts.csv  The content Accounts.csv file as below: [email protected],123456789,Huu1,Phan Van,Phan Van Huu1 (IT),mail.huuphan.local [email protected],123456789,Huu2,Phan Van,Phan Van Huu2 (IT),mail.huuphan.local zimbra create multiple accounts csv file full script zimbra create multiple accounts with zimbra_account.sh name #!/bin/bash # File Accounts.csv as below: # [email protected],123456789,Huu1,Phan Van,Phan Van Huu1 (IT),mail.huuphan.local # [email protected],123456789,Huu2,Phan Van,Phan Van Huu2 (IT),mail.huuphan.local DATE=$(date) OLDIFS=$IFS IFS=',' File_Name="/opt/Account/Accounts.csv" Out_log='/tmp/outfile.log'         echo "$DATE - To create account Email" | te

zimbra create multiple accounts

Image
# In this tutorial, we will cover how to create multiple accounts in Zimbra using a file containing a list of commands for creating email accounts. To automate the account creation process, we will use a script.  For this purpose, we will create a commands.zmp file that contains the necessary commands for creating the accounts." How to do it....? Step 1: To create commands.zmp file with the content as top The content commands.zmp file you changed the appropriate attributes of your account Account: [email protected] Password: 123456789 SN: huupv1 displayName: 'Huu1, Phan Van (IT)' zimbraMailHost: mail.huuphan.local you can ref to zmprov command create accounts Step 2: To use zimbra account su - zimbra Step 3: To use zmprov command to create multiple accounts zmprov -f commands.zmp The conclusion zimbra create multiple accounts atop very simple. However, I recommend use script to create multiple accounts for file .csv. I will writing the scri