9_Working_with_Secure_Shell
9_Working_with_Secure_Shell
In this lesson, we will learn how to communicate with our server remotely.
SSH was originally developed because of the security concerns regarding its
predecessor, Telnet. Server communication is now much more secure
because of the data encryption methods used by the SSH protocol. In terms of
functional power, SSH allows us to basically control every aspect of the server
running our website.
Now, let’s take a look at how we can set up the SSH terminal on our machine.
Basic Commands #
The most important SSH command is to open a connection to our remote
server. Here is the command we need to run on the terminal:
First, we need to define the user , which is the account we want to use. The
next step is to mention the domain name or the IP address of our website. For
example, the root user would open up a connection on our platform this way:
We must then put in our password to access the server. This connection is
secured by SSH using hashing, symmetric encryption and asymmetric
encryption. Without getting into details, all we need to know is that this is a
big improvement over Telnet’s security measures.
Below, we’ve listed a few more basic operations that can be performed on the
SSH terminal.
Create a new
mkdir mkdir newDirectory
directory.
a specified format
Delete a file or
directory. Use rm -r
rm to remove all files in rm newDoc.txt
the directory being
deleted
cp source
Copy files and destination (we can
cp
directories. use several flags
before source )
scp filename
host:path ( host can
Copy files/folders to
scp be the host domain
and from the server.
name or the IP
address)
This list is not exhaustive by any means. For more details, visit Secure Shell’s
official website.
Port Number #
By default, SSH connects to port 22, but we can always choose a different port
if we want. Opting for another port is also useful because hackers will only try
to attack port 22.
To change the port number for SSH, we run the following command:
Git Repositories #
If Git is installed on our machine as well as the server machine, we can create
private Git repositories using SSH. We simply have to move to the desired
directory on the server and run this command:
git init
Now that we’ve understood SSH, we’ll move on to the File Transfer Protocol
and learn how it is incorporated with SSH.