Posts Under Category: SSH

PuTTY is a free and open-source SSH / telnet client for Windows and Unix platforms.
A newbie can find it difficult how to use copy / paste in putty.

How to copy in putty

Using left click of your mouse select the text you want to copy.
That’s it. The selected text will be copied to your clipboard.

How to paste in putty

Simply right click and it will paste the copied text.

Our Recommended VPS Hosting

If you use ping command in SSH, it will continue pinging and extending output lines without any stoppage. Something like below screenshot.

Here is how you can exit from ping command. Simply press below key on your keyboard.

Ctrl + C

Our Recommended VPS Hosting

The default SSH port on centOS 7 (32-bits / 64-bits) server is 22. But for security reasons, it is recommended to change the default SSH port number. Here is how you can change your centOS 7 server / VPS SSH port number.

Step 1:

Login to your server as root via SSH.

Step 2:

Backup the configuration file before editing it.

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup

Step 3:

Open following file in any text editor like nano.

nano /etc/ssh/sshd_config

Step 4:

Find following code in /etc/ssh/sshd_config file.

#Port 22

Change this line to new port number and remove #
Like if we want to make 2121 as new ssh port number.

Port 2121

Save the change using: Ctrl + O
Exit nano editor using: Ctrl + X

Step 5:

Allow the new port in firewall. If you use any third party firewall like csf firewall, add the new port in allowed port list.
If you are using default OS firewall, use following command to allow new port.
Below command will allow port 2121.

firewall-cmd --add-port 2121/tcp --permanent
firewall-cmd --add-port 2121/tcp

Step 6:

Restart SSH using below command.

service sshd restart

Don’t close your current SSH session. Instead start a new SSH session in a new widows with new SSH port number.
If you are able to login using new SSH port number, you have successfully changed your server SSH port number.

If you are unable to login using new SSH number, it means you have done something wrong. You should consider reverting all changes made in step 3.

Our Recommended VPS Hosting

We generally use wget command to download any particular file on a server. But what if I want to download a complete directory / folder.

Here is how you can download a full directory / folder using wget SSH command. Suppose, I want to download all files and folders under

So, my SSH command will be:

wget -r

Our Recommended Dedicated Server

cPanel offers you to schedule backup and retain backup of server and accounts. But if you need to run backup manually, you can do it from SSH. Login to your server as root via SSH and run following command.

For cPanel new Backup system


If the backup is up-to-date, you can force to run backup using below command

/usr/local/cpanel/bin/backup --force

For cPanel Legacy backup system


If the backup is up-to-date and you wish to run backups anyway, use:

/usr/local/cpanel/scripts/cpbackup --force

Our Recommended Dedicated Server

Please follow below steps to change root password via SSH of a dedicated server / VPS.

Step 1:

Login as root to your server via SSH.

Step 2:

Run below command


Step 3:

Enter your new password and press enter.

Step 4:

Re-enter your new password to confirm the password.

If completed successfully, the shell will show you a successful message showing

passwd: all authentication tokens updated successfully.

root password changed


Our Recommended VPS Hosting

How to create a file via SSH

To create a file via SSH use touch command.
Like I want to create a file lophost.text in /home, I will use below command

touch /home/lophost.txt

This will be a blank file, which we can edit later.

How to create a folder / directory via SSH

Use command mkdir to create a new folder / directory. Like I want to create a folder lophost in /home

mkdir /home/lophost

Our Recommended Dedicated Server

CD command is used for navigation to different directories on a Linux machine. Below I have explained some basic things about CD command.

How to know current directory

If you want to know your current directory, run below command:


ssh-pwd command

Default directory for root

when you login as root your default directory is


How to move to another directory

Support you want to move to /home directory, use below command

cd /home

To go up a directory

To move to one level up directory use:

cd ..

To go to Top level

cd /

To go to your home directory

cd ~

This will take the use to his home directory. Like for user root home directory is /root

Our Recommended Dedicated Server

In this tutorial I will explain how to mass change permission of all files and folders/directory on a Linux server.
Login to server via SSH as root and execute following commands.

To change permission of all files and folders to 644 in /home/username/pulic_html

chmod 644 /home/username/public_html -R

To change permission of all files to 644 in /home/username/pulic_html

cd /home/username/pulic_html
find . -type f -exec chmod 644 {} \;

To change permission of all folder to 755 in /home/username/pulic_html

cd /home/username/pulic_html
find . -type d -exec chmod 755 {} \;

Our Recommended Dedicated Server

Login to your server as root via SSH and run below command:

To start Apache

service httpd start

To stop Apache

service httpd stop

To restart Apache

service httpd restart

Our Recommended VPS Hosting