26 Aug

Fixing File and Directory Permissions for cPanel Users with a Bash Script

Managing file and directory permissions on a cPanel server is crucial for both security and functionality. Incorrect permissions can expose sensitive data or cause website errors. This guide shows you how to use a Bash script to quickly fix permissions for cPanel users.

Why Are Permissions Important?

In Linux systems, permissions determine who can read, write, or execute files and directories. The most common permission settings are:

  • Directories: 755 – Owner has full control; others can read and execute.
  • Files: 644 – Owner can read and write; others can only read.

These settings protect your files while allowing websites to function correctly.

Bash Script to Fix Permissions

Here’s a simple Bash script to adjust permissions for a specific cPanel user:

#!/bin/bash
# Script to fix permissions for a cPanel user

if [ "$#" -lt "1" ]; then
echo "Must specify user"
exit
fi

USER=$@

for user in $USER; do
HOMEDIR=$(egrep "^${user}:" /etc/passwd | cut -d: -f6)

if [ ! -f /var/cpanel/users/$user ]; then
echo "$user user file missing, likely an invalid user"
elif [ "$HOMEDIR" == "" ]; then
echo "Couldn't determine home directory for $user"
else
echo "Setting ownership and permissions for user $user"
chown -R $user:$user $HOMEDIR
chmod 711 $HOMEDIR
chown $user:nobody $HOMEDIR/public_html $HOMEDIR/.htpasswds
chown $user:mail $HOMEDIR/etc $HOMEDIR/etc/*/shadow $HOMEDIR/etc/*/passwd

find $HOMEDIR -type f -exec chmod 644 {} \; -print
find $HOMEDIR -type d -exec chmod 755 {} \; -print
find $HOMEDIR -type d -name cgi-bin -exec chmod 755 {} \; -print
find $HOMEDIR -type f \( -name "*.pl" -o -name "*.perl" \) -exec chmod 755 {} \; -print
fi
done

chmod 750 $HOMEDIR/public_html

if [ -d "$HOMEDIR/.cagefs" ]; then
chmod 775 $HOMEDIR/.cagefs
chmod 700 $HOMEDIR/.cagefs/tmp
chmod 700 $HOMEDIR/.cagefs/var
chmod 777 $HOMEDIR/.cagefs/cache
chmod 777 $HOMEDIR/.cagefs/run
fi

How to Use the Script

  1. Save the Script: Save the code to a file named fixperms.sh.
  2. Make It Executable: Run chmod +x fixperms.sh to make the script executable.
  3. Run the Script: Execute the script by running bash fixperms.sh <username>, replacing <username> with the cPanel username.

Conclusion

This script provides a quick way to standardize file and directory permissions for cPanel users, enhancing security and functionality. Always test scripts in a safe environment before applying them to production servers.

By following these steps, you can ensure that your cPanel environment is secure and operating smoothly.

13 Aug

How to Install PPTP VPN on Linux

Setting up a PPTP VPN server on a Linux machine is a straightforward process. This guide will walk you through the steps required to get your VPN server up and running.

Step 1: Install PPTPD

PPTP depends on the PPP and PPTPD packages. To install them, run the following commands:

yum install pptpd

Or, download and install the PPTPD package using:

wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.4.0-1.el6.x86_64.rpm
rpm -Uhv pptpd-1.4.0-1.el6.x86_64.rpm

Step 2: Configure PPTPD

After installation, you’ll need to configure the PPTPD server. Start by editing the IP settings in the /etc/pptpd.conf file:

nano /etc/pptpd.conf

Add or modify the following lines:

localip 192.168.0.1    # Server's primary IP
remoteip 192.168.0.100-200

Next, update the DNS settings in the /etc/ppp/options.pptpd file:

nano /etc/ppp/options.pptpd

Add the following lines:

ms-dns 8.8.8.8
ms-dns 8.8.4.4

Step 3: Create a VPN User

To allow access to the VPN server, you’ll need to create a user account. Add the user credentials in the /etc/ppp/chap-secrets file:

nano /etc/ppp/chap-secrets

Insert the following line:

username pptpd password *

Replace username and password with your desired credentials.

Step 4: Enable IP/Network Forwarding

IP forwarding is essential for routing packets between VPN clients and the internet. Enable IP forwarding by editing the /etc/sysctl.conf file:

nano /etc/sysctl.conf

Uncomment or add the following line:

net.ipv4.ip_forward = 1

To apply the changes, run:

sysctl -p

Step 5: Configure IPTables for NAT

NAT (Network Address Translation) allows VPN clients to access the internet through the server’s public IP. First, identify your network interface (e.g., eth0, ens33) by using the ifconfig command.

Assuming your network interface is eth0, add the following IPTables rules:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -j ACCEPT

Save these rules to ensure they persist after a reboot.

Step 6: Start and Enable the PPTPD Service

Finally, start the PPTPD service and enable it to run at boot:

systemctl start pptpd
systemctl enable pptpd

Your PPTP VPN server is now set up and ready to use. You can connect to it using any PPTP VPN client with the user credentials created earlier.

23 May

Important Update: Google Workspace Pricing Adjustment Effective June 1, 2024

Thank you for your ongoing partnership with TetraHost for your Google Workspace services. We are writing to inform you about an upcoming adjustment to the pricing of our Google Workspace services, effective June 1, 2024.

This change is driven by two key factors: a recent pricing update from Google and the continuous upward trend in the dollar exchange rate. While we understand that any price increase can be concerning, we want to assure you that this adjustment is necessary to maintain the high-quality service you’ve come to expect from TetraHost.

Pricing Adjustment Details:

For Existing Users:

The new pricing will be reflected in your renewal invoice starting June 1, 2024.

For New Users:

Clients subscribing to our Google Workspace service after June 1, 2024, will be subject to the new pricing.

Despite these changes, our commitment to providing exceptional value and support remains unwavering. Google Workspace continues to offer innovative features and collaborative tools designed to help your business succeed.

If you have any questions or concerns about this pricing adjustment, please do not hesitate to contact our dedicated customer support team at support@tetrahostbd.com or +8801711825320. We are here to assist you with any inquiries.

We sincerely appreciate your understanding and continued trust in TetraHost as your Google Workspace service provider. We look forward to continuing to serve you with the highest level of service.

Thank you for your continued partnership.

22 Nov

Troubleshooting ‘WebSocket Handshake Failed’ Error in cPanel’s Terminal Feature

Encountering the “Error: The WebSocket handshake failed” message while using the Terminal feature in cPanel can be frustrating, especially if you’re accessing cPanel through a sub-domain like https://cpanel.yourdomain.com.

Why does this error happen?

When you try to open the Terminal in cPanel, it uses something called a “socket.” This socket needs to confirm where you’re connecting from. If it detects a proxy, it stops working.

How to solve it:

Mostly, this happens when user uses third party DNS server such as Cloudflare. Cloudflare’s way of hiding your real IP address causes this problem. To fix it, try accessing cPanel using a server IP address or the server’s hostname instead of the Cloudflare-protected one.

By doing this, you can bypass the error and use the Terminal feature in cPanel hassle-free.

Here’s what you can try to fix it:

1. Use these links to access cPanel >> Terminal:

– https://server-ip-ipaddress:2083
– https://server-hostname:2083

If these links don’t work, try these steps:

– Turn off any proxies or VPNs you might be using.
– Try different web browsers to see if that helps.

If you’re still experiencing issues with this problem, please reach out to our support team for assistance via https://www.tetrahostbd.com/contact.

17 Oct

Troubleshooting Network Issues Using MTR Reports

MTR, a network diagnostic tool, assesses the network connections between your physical location and your hosting server. It blends the capabilities of both ping and traceroute, enabling you to consistently monitor a remote server and observe how latency and performance change over time. To conduct an MTR test on Windows, you’ll need to install WinMTR, which can be obtained from this link.

Once it’s installed, launch WinMTR.

1. In the “Host” field, input the domain name or IP address you want to trace, and then click the “Start” button.
2. Allow it to run for at least 30 seconds, then click the “Stop” button.
3. Capture or export the results in either text or HTML format, and send them to your provider via email. This will help them to analyze the data(please include your public IP address as well).

27 Apr

Notice of Temporary Blockage of Our bKash Merchant Account

Dear Valued Clients,

We regret to inform you that our bKash Merchant account has been temporarily blocked by bKash authority. As a result, we are unable to process transactions through this account at the moment. We apologize for any inconvenience this may cause.

However, we have alternative payment options available for you to continue doing business with us. You can use our bKash Personal account with the number 01913377417, or Nagad Personal account with the same number for any transactions. Additionally, you can also use our company bank account or automated SSLCommerz payment gateway for hassle-free transactions.

We assure you that we are working closely with bKash to resolve this issue and we will notify you as soon as our Merchant account is available again. We thank you for your patience and understanding during this time.

If you have any questions or concerns, please do not hesitate to reach out to us.

Thank you,

TetraHost

26 Jan

Setup Node.js Application in cPanel

We have Cloudlinux installed on shared hosting server which comes with Python and Node JS support. In this tutorial, WE will learn how to easily set up Node.js applications from the cPanel interface.

In order to set up a Node.js application using cPanel interface, use the following steps.

Step #1: Create the application
First, you must create an application. To do this, follow these steps:

Log in to cPanel >> Software >> Setup Node.js App

 

 

On the Node.js selector page, click CREATE APPLICATION to start the application setup:

 

Fill in the fields on the application setup form:

 

 

 

 

 

 

 

 

 

  • Node.js version – select your preferred version from the drop down list
  • Application mode – choose Development or Production from the list. Development may be chosen initially and changed to production later.
  • Application root – the file system location for application files. The entry will be appended to /home/username to form the complete path to the application files in the cPanel home directory.
  • Application URL – the address of the application on the Internet.
  • Application startup file – the initial file that will be processed when launching the application.

Once all information is properly submitted, click CREATE:

 

The application starts automatically. To view a test page for the application, click OPEN:

 

You should see the “It Works!” message appears with the installed version.

Now that a working application is installed, you can enhance the environment with the package.json settings file and the npm package manager.

To do this, follow the next steps:

Step #2: Create the package.json file

To create the package.json file, follow these steps:

cPanel >> File Manager

 

 

In the left hand column of File Manager, click the text of the application root folder:

 

 

 

Click +File to create a new file:

 

In the New File dialog box, type the filename package.json, and then click Create New File:

 

 

 

 

 

 

 

 

Right-click or secondary click on the package.json file in the right-hand column of File Manager and then click Edit. An edit dialog box appears:

 

 

 

 

 

 

 

 

 

In the Edit dialog box, click OK.

Type the following text in the editor screen:

{
"name": "app",
"version": "1.0.0",
"description": "My App",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}

Click Save Changes to save the file and Click Close to close the editor.

Step #3: Install npm

To install npm, follow these steps:

cPanel – Software – Setup Node.js App

 

 

In the Actions column of the Web Applications list, click the pencil icon of the application you want to edit >> Click Run NPM Install >> The NPM installation runs and displays a success indicator when complete.

 

 

 

To install packages with NPM and do other command line tasks related to the application, log in via SSH and enter the virtual environment for the application using the command shown in the information box at the top of the application setup page:

 

 

 

Great! Now you know how to install Node.js app using the cPanel interface.

04 Dec

Outlook Express Configuration!

We are asked by few of our clients on how to configure Outlook Express with our email server. Once you are done with creating the Email Account from cPanel, note down your login details. Open Outlook Express and follow the steps:

Outlook Configuration:

## You need the check the box that says “My Server Requires Authentication” from SERVERS Tab.
## From ADVANCED Tab please check both the box that says “This server requires a secure connection (SSL)”.
## Please change the Outgoing mail (SMTP) port to 465 and Incoming mail (POP3) port to 995.
## Set your incoming and outgoing mail server address to “mail.domain.com”.

If the above setting does not work for you then please submit a ticket, but it should work definitely.

26 Nov

Announcement: Pricing Update for Major Domain TLD

We hope you are doing well and enjoying the services which you have taken from TetraHost. If there any issue or have query please let us know via support@tetrahostbd.com or visit our livechat at tetrahostbd.com or call us at +8801913377417

This email is regarding domain price update. We believe you all are aware of hike in the dollar exchange rate. As per our calculation, the exchange rate has increased around 25%. This is happening for last few months but We did not increased price from our side. We wanted to maintain the old price but unfortunately the situation is not allowing us to maintain the old domain price.

Finally We have decided to increase the price from 1st December, 2022.

Below are the list for major domain TLD

Extension Registration Transfer Renewal
.COM 950 950 1200
.NET 1050 1050 1300
.ORG 1150 1150 1400
.INFO 1550 1550 2000
.BIZ 1450 1450 1700

Few other domain extension pricing information is available on the following URL:
https://www.tetrahostbd.com/domains

22 Jul

Important Notice: Server Migration – Mirage – 28/07/2022

Server Name: Mirage
Server Hostname: mirage.ihostman.com
Primary IP: 69.46.21.178

mirage.ihostman.com” is one of our shared hosting server and is providing service for 5+ years. We have decided to leave this server and move to a better/latest hardware and also change the server physical location. Mirage is currently located at our USA datacenter, We have taken new server at our Bangladesh location.

Below is the server hardware specification:

Processor: Dual E5 2690 v3(24 Core)
RAM: 64GB
HDD: 1 x 2TB NVMe
Location: Bangladesh

This server will have bdix connection of speed 1gbit.

Below is the Server Migration Schedule:

Date: Thursday, 28th July, 2022
Time: BST 10 PM (GMT +6)

We do not expect any downtime during this migration and no action is required from client end. Our team will perform all the required task and complete the migration work. We hope to complete the work in 6 hours time.

If you have any query regarding this migration, please contact us via support [at] tetrahostbd.com .