Monday, September 26, 2022
How to change Folder and File Permission in Linux
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;
sudo chmod 644 /var/www/html/textbook.php
sudo chmod 644 /var/www/html/textbook.php
sudo systemctl restart httpd
Wednesday, September 21, 2022
Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache Engine
sudo /etc/init.d/apache2 restart
sudo service apache2 restart
Stop
/etc/init.d/apache2 stop
sudo /etc/init.d/apache2 stop
sudo service apache2 stop
/etc/init.d/apache2 start
sudo /etc/init.d/apache2 start
sudo service apache2 start
sudo systemctl stop apache2.service
sudo systemctl restart apache2.service
sudo systemctl status apache2.service
Tuesday, September 20, 2022
Two-Factor Authentication (2FA) for Webmin with Google Authenticator
Install Perl CPAN Module in CentOS 8
perl -MCPAN -e 'install Authen::OATH'
cpan -i Geo::IP OR
You need gcc.:
Get CPAN:
Configure CPAN ( just run CPAN ):
After CPAN is configured:
When Authen::OATH is successfully installed, configure 2FA in WebMin.
Monday, September 19, 2022
How to use multiple SSH key for same user by adding to ssh agent
Friday, September 16, 2022
Installing PHP 7.4 on macOS Sierra without brew?
sudo port install php74
sudo port install php74-cgi php74-gd php74-curl php74-intl php74-iconv php74-gettext php74-mbstring php74-imap php74-mcrypt php74-xmlrpc php74-mysql php74-openssl php74-sockets php74-zip php74-tidy php74-opcache php74-xsl php74-sqlite
sudo port select php php74
Thursday, September 15, 2022
How to remove directory in Linux
To permanently remove a directory in Linux, use either rmdir or rm command:
- For empty directories, use
rmdir [dirname]
orrm -d [dirname]
- For non-empty directories, use
rm -r [dirname]
Before you remove a directory, you need to know the name of it. To discover files and directories, use the ls command, and to know the current directory you are in, use the pwd command.
The options you use together with these commands are also important to determine how they work. Here’s a quick recap of rm command options:
Command and Option | Description |
rm -d | Remove an empty directory using the rm command. |
rm -r | Remove a non-empty directory and its content. |
rm -f | Ignore any prompt when deleting a write-protected file. |
rm -rf | Ignore any prompt when deleting a write-protected non-empty folder. |
rm -i | Output a prompt before deleting every file. |
rm -I | Output a prompt only once before deleting more than three files. |
rm * | Wildcard that represents multiple characters. |
rm ? | Wildcard that represents a single character. |
rmdir -p | Remove an empty subdirectory and its parent directory. |
rmdir -v | Print the information that the specified directory was deleted. |
/usr/bin/env: 'php': No such file or directory CentOS Stream
Convert from CentOS Linux 8 to CentOS Stream 8
dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos
dnf distro-sync
Monday, September 12, 2022
Reset MySQL Root Password on Red Hat Enterprise Linux 8
Sunday, September 11, 2022
Make PPK to Pem using Mac terminal
or
This will also install puttygen. To get puttygen to output a .PEM file:
puttygen privatekey.ppk -O private-openssh -o privatekey.pem
Once you have the key, open a terminal window and:
The private key must have tight security settings otherwise SSH complains. Make sure only the user can read the key.
Thursday, September 8, 2022
Sunday, September 4, 2022
How to access EC2 instance if lost key Pair and root credentials
Step-1:
Create a new instance with same OS as previous one or create it from AIM made from old instance
Step-2:
Shutdown the old instance and detach the volume
Step-3:
Shutdown new instance Attached the detached volume to new instance and start the instance
Step-4:
Login new instance using ssh console
Run the following commands:
lsblk
df -h
cd mnt
mkdir oldvolume
sudo mount /dev/sda1 mnt/oldvolume
cd mnt/oldvolume/root/.ssh
sudo vi authorized_keys
Now add your public key and save
umount /dev/sda1
sudo shutdown now
Step-5:
Now detach the dev/sda1 volume from new instance and attach to old instance as dev/sda
Step-6:
Reboot old instance from AWS dashboard and login your old instance using ssh console
Note: Your old instance IP will be changed after doing this if no elastic IP
Friday, September 2, 2022
Install NVM (Node Version Manager) on macOS with Homebrew
echo "# Homebrew\nexport PATH=/opt/homebrew/bin:\$PATH" >> .bash_profile
source ~/.zshrc
brew install nvm
mkdir ~/.nvm
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> .bash_profile
source ~/.bash_profile
or
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> .zshrc
source ~/.zshrc
nvm install 12.13.0
nvm install --lts
How to get Ranking of the Students in Excel using RANK Function
=RANK(number,ref,[order]) To rank in descending order, we will use the formula =RANK(B2,($C$5:$C$10),0) If we want unique ranks, we can use...
-
Put the following code in a TXT file and save as "file.cmd" then run the cmd file as administrator. @echo off title Activate Micr...
-
We can install PowerMTA on the server. rpm -ivh /home/PowerMTA-4.0r6.x86_64.rpm You will see the output like this Preparing... #############...
-
# $Id: config 2015-03-24 16:00:00 Jack $ # Sample PowerMTA configuration file # PowerMTA Multiple Virtual PMTA config file sample # # E-mai...