Saturday, 6 November 2021

Setting host name in CentOS Linux 8

 

We can set host name to a Linux system by directly updating name in /etc/hostname file which will require reboot. 

In CentOS Linux 8 and latest versions we have hostnamectl command that will do the job without need of reboot.


Command - hostnamectl 
Syntax - hostnamectl set-hostname NAME






This will automatically update the /etc/hostname file and no reboot is required. 





Thursday, 4 November 2021

Configure local repository on Ubuntu

 

Configure local repository on Ubuntu

Prerequisites:

·        Install Apache2
·        Install apt-utils
·        Install dpkg-dev

Server-side configuration:

1.       Download required packages in one machine.

2.       Create a directory in /var/www/ as below,

            Now move to the binary directory,

4.       Move your downloaded packages to this directory.

5.       Create a file named Packages which apt-get can read using the following command,      

# apt-ftparchive packages > Packages

6.       Now create a zip file of that Packages file created above using below command,

# gzip -c Packages > Packages.gz

Client-side configuration :

1.       Change the internet configurations with no internet.

2.       Edit the /etc/apt/sources.list file as shown below,

deb http://yourIP/localrepo/pkg/binary /

And hash all other lines. Save and exit.

3.       Issue apt-get update the changes you made in sources.list will be updated and you will get a message like below,

Reading packages lists….. Done.

4.       Once successfully verifying the sources you can start installing any package available from your local repository using apt-get.

# apt-get install package_name

Note : you will get a warning like package is not authenticated just continue with yes and the package will be downloaded.

RBL Whitelisting with zimbra postfix

 RBL Whitelisting with zimbra postfix 

Cause: Genuine IP is being Blocked by the RBL.

RBL - Real-time Black hole list.

Common RBL providers - BarracudaCentral, SpamHaus.

When you find any genuine email blocked reason as smtp blacklisted/ip blacklisted in log messages then it can be whitelisted with zimbra postfix as explained below.

Note: If sender domain / IP is blacklisted with global RBL, it might be affected by suspicious infection. Hence try to find the reality and then proceed accordingly. Whitelisting affected senders might increase chances of your domain also getting infected. 

Resolution:

    1. Create a file postfix_rbl_override in /opt/zimbra/conf/

    2. Add the IP/Domain Name to be whitelisted in the file /opt/zimbra/conf/postfix_rbl_override as shown below,

##

192.168.1.5   OK
Domainname.com OK

##

    3. Issue the postmap command as below ,

## postmap /opt/zimbra/conf/postfix_rbl_override

    4. In the smtpd_recipient_restrictions.cf file include the following lines, just above the line reject_unlisted_recipient

check_client_access hash:/opt/zimbra/conf/postfix_rbl_override

check_recipient_access hash:/opt/zimbra/conf/postfix_rbl_override

Note: For 8.x the file is located in opt/zimbra/conf/zmconfigd/smtpd_recipient_restrictions.cf

And for versions below 8.x you should edit the file /opt/zimbra/conf/postfix_recipient_restrictions.cf

After making changes restart the zimbra mta service.

## zmmtactl restart

Configuring samba standalone server

 

Configuring samba standalone server

To share files from linux to windows machine samba is used. Below lets see how to install and configure samba to share files from linux to windows. 

Step 1: Check if samba package is installed, using the following command.

# rpm –qa samba*

Step 2: If samba is not installed then install samba using following command.

# yum install samba

Step 3: Create a Directory you want to share.

# mkdir directory_name

Step 4: Grant the directory full permission.

# chmod 777 directory_name

Step 5: Now create a share user.

# useradd directory_name

Step 6: Create password for the user.

# passwd username

Step 7: Now to share the directory edit the smb.conf file using following command.

# vi /etc/samba/smb.conf

Step 8: Change the workgroup to your workgroup.

Add the following lines in the end of this file /etc/samba/smb.conf

Save this file and exit using Esc :wq

Step 9: check the firewall status, if it is on turn off the firewall.

# service iptables status

Step 10: Turn off firewall.

# service iptables stop

Even after turning off the firewall while rebooting it starts so to permanently turn it off.

# chkconfig iptables off

 Check the firewall status again.

# service iptables status

Step 11: Turn off Selinux

# vi /etc/sysconfig/selinux



Change selinux to disabled if it is in enforcing. Save and quit using Esc :wq

Step 12: Now start samba service.

# service smb start


This starts the samba service but when you restart it turns off to turn it on

# chkconfig smb on


To check the status of samba service

# service smb status

Step 13: Create sharing users password

# smbpasswd -a sharing

Step 14: Reboot your computer and open windows computer and access the shared folder with this password and the username for which you have created the smbpasswd, here it is Sharing(username).

To change permissions for shared folders.

Restricting shared folder to one user alone.

Create a new user you want to allow permission for writing the shared folder.

Edit the smb.conf  file and change the value for writable as no in the folder which you want to restrict, and change the value of write list to the user name which you want to allow permission. Here the user name is Sharing.


Share restricted for all user except for user(Sharing).

Wednesday, 3 November 2021

Dual boot windows 7 & Ubuntu using windows installer

 

Dual boot windows 7 & Ubuntu using windows installer

 Prerequisites

1.       Windows 7 installed.
2.       Ubuntu 12.04 iso and wubi.exe file to be copied on the windows 7 machine.

Installation steps

     èDownload the windows installer wubi.exe file from http://www.ubuntu.com/download/desktop/windows-installer

     èCopy the wubi.exe file and the iso file in same directory



èNow run the wubi.exe windows installer file, you will require administrative rights to do this, you wil get a dialog box as shown below,


èSelect the installation drive where you want to store the installation files of Ubuntu,

 
èSelect the installation size for the Ubuntu a minimum of 5GB and maximum of 30GB will be available based on the space available on your disk selected,

 

èSelect the desktop environment here it is ubuntu, give the password for the username which you will be using to logon into ubuntu.

           è Now click Install and the installation procedure will start with the following screen

èAfter the installation files copied to the drive setup will ask for reboot, select reboot and click finish.



èNow the system will reboot and start the Ubuntu installation



èAfter installation is completed, and after rebooting your system  is ready with dual booting select the required os and you can work with it.

èSelecting Ubuntu will show the following screen select the first and Ubuntu will be loaded



èThe partition in ubuntu shows as below,

 

Sunday, 24 October 2021

Basic Linux commands

Basic Linux commands and its uses


Following are the basic linux commands, getting familiar with below commands will help beginner in linux administration.

Each command has a extensive manual page for it. We can review the man page using syntax as below, 

#man <command_name>


ssh - connect to another server over network
syntax: ssh server_name

ls - list files and directories.
syntax: ls

pwd - print present working directory 
syntax: pwd

cat - read contents of file without editing the file
syntax: cat file_name

vi - view/edit contents of a file.
syntax: vi file_name

rm - remove / delete a file 
syntax: rm file_name

rmdir - remove / delete directory and its contents
syntax: rmdir directory_name

cp - copy a file from one location to another 
syntax: cp source_file destination_path

cd - change directory to given path
syntax: cd destination_path

grep - find a particular pattern in given file
syntax: grep test filename.txt

yum - Install / remove /update packages/softwares.
syntax: yum install package_name
            yum remove package_name
            yum update package name

Wednesday, 20 October 2021

Squid proxy


Step 1: Install squid using following command.

[root@MailZim ~]# yum install squid

Step 2: Now configure the network of the windows machine in which you want to control the internet using this proxy as shown below.

Step 2.1: Open run command and type inetcpl.cpl

 







Step 2.2: In internet properties select connections tab and select Lan settings.









Step 2.3: Select use a proxy server for your LAN as shown below and type your proxy server ip address here it is 192.168.1.63 and default port is 3128.









Step 3: open Ip properties and remove the dns and gateway. As shown below,









Now check opening google on any of your browser, if it opens then proxy is working perfectly, else check the above steps properly.

Step 4: Add the following highlighted lines in the squid.conf file using following command.

[root@MailZim ~]# vi /etc/squid/squid.conf








Save and exit using Esc :wq

Step 5: Now create a new file using which you are going to block a group of websites, for which  the path is as said in the above highlighted lines, here it is




Step 6: Add the sites which you want to block as shown below, starting with . no www is needed, save and exit after edititing.






Step 7: Now reload the squid proxy service, using the following command,



Step 8: To block sites separately without using any file add the following lines in squid.conf file, as shown below,

acl google dstdomain .google.com

http_access deny google








Step 9 : reload the squid service.

 

 

DONE !!! blocked using proxy squid.