Saturday, August 27, 2022

Fix ssh port 22 connection refused ubuntu

sudo apt install openssh-server

sudo apt list --installed | grep openssh-server

sudo service ssh status

sudo service ssh start

sudo service ssh restart

ssh [username]@[remoteserver IP or hostname]

ssh -p [port_number] [username]@[ip_address]

sudo netstat -ltnp | grep sshd

ssh -p [2244] [username]@[ip_address]

sudo ufw allow port /tcp

sudo ufw allow 2244/tcp

sudo ufw reload

sudo ufw status

sudo apt install arping

ping <ip-address>

Thursday, August 25, 2022

How to add public key to authorized_keys ec2 instance Ubunutu Linux

 Step 1: Login into you AWS account and go to EC2 instances

Step 2: Select your instance and click connect

Step 2: Then click connect button at the bottom right corner

Step 3: Now a new tab will be opened with console as follows

Step 4: Copy your SSH public key then add the key to the following key file

Use this command in Mac/Windows powershell to copy your public key: pbcopy ~/.ssh/id_rsa.pub

nano ~/.ssh/authorized_keys

Step 5: Save and reboot then try to connect again with device from which public key generated.

Tuesday, August 23, 2022

Fix laravel SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock


Cause:

his happens when two processes or more are trying to write to the same database table at the exact same time. Solutions can be complicated. Deadlocks are usually an application problem most of the time can either be solved by:
1. changing the logic of your code (e.g. use transactions) or
2. retrying the operation

      php artisan route:list
      php artisan view:clear
      php artisan cache:clear

Thursday, August 18, 2022

How to add SSH Public key to an existing Droplet or VM?

First copy your Public key using the following command: 

cat ~/.ssh/id_rsa.pub

or 

pbcopy ~/.ssh/id_rsa.pub

Now login into your Droplet or VM and open the following file then paste your public key into authorized_keys file.

nano ~/.ssh/authorized_keys


Save the file and try to login from your local terminal.

Monday, August 15, 2022

Fix Adding new SSL virtual website .. .. certificate authority file is not valid : Data does not start with line -----BEGIN CERTIFICATE-- in virtualmin


Open the file at /etc/webmin/virtual-server/domains/13694005276497

Delete including 4 lines pointing to the 4 certificate files: ssl.cert, ssl.combined, ssl.everything & ssl.key

Then re-add the ssl.

Friday, August 12, 2022

How to generate SSH keys in Windows PowerShell

 Open your PowerShell and follow the steps:

ssh

ssh-keygen -b 4096


C:\Users\WINUSER/.ssh/id_rsa.pub


notepad C:\Users\WINUSER/.ssh/id_rsa.pub

Wednesday, August 10, 2022

How to check TCP, UDP Domain Socket using NetCat

 Install the netcat Using the fllowing command:

$ yum install nc      [On CentOS/RHEL]

$ dnf install nc      [On Fedora 22+ and RHEL 8]

$ sudo apt-get install Netcat      [On Debian/Ubuntu]


NetCat commands:

$ nc -v -w 2 z 192.168.56.1 22     #scan a single port

OR

$ nc -v -w 2 z 192.168.56.1 22 80  #scan multiple ports

OR

$ nc -v -w 2 z 192.168.56.1 20-25  #scan range of ports

Office 2021 Activation using command

  @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - office.com&cls&echo =====================================...