Hello. My name is Corey Thompson. And in these Lessons you will learn basic SSH syntax and usage, how to modify the user SSH configuration file to allow custom behaviors, and how to set up and save SSH connection information on PuTTY in a Windows environment. In this lesson, I will show you basic SSH syntax. And usage to include how to connect to a nonstandard port and other SSH Parameters. Let's explore the basic syntax and usage of SSH along with a practical example on an immune to system. The syntax for SSH is simple and follows the following format. The first thing, we need to type is SSH This is the command to initiate. The SSH client. This is the Binary that we call in order to make a secure remote connection. If you run the which SSH command, You can see. And when we type SSH, it's the same thing as typing. The/usr/bin/ssh. This is the directory where the SSH binary lives. The next field is the options. Optional flags can modify the behavior of the SSH client. Some of the commonly used options include -P to specify a custom port. I to use a specific private key file for authentication and -X to enable X11 forwarding for graphical applications. There is also the -D to specify a dynamic port forwarding. Dynamic port forwarding in SSH, also known as SSH Dynamic Stocks Proxy is a powerful feature that allows users to create a secure tunnel for routing network traffic through an SSH server. This type of Port forwarding is particularly useful when you need to access the internet or resources on a private network from a client machine located outside the network. The -L specifies local port forwarding, Offering a versatile and secure way to access remote services and resources, providing users with flexibility, and added security, when interacting with remote systems. The -r is for remote port forwarding, which is another feature provided by SSH that allows users to create a secure tunnel to forward traffic from a port on a remote server, to a specific destination port on their local machine. Unlike local port forwarding, which forwards traffic from the local machine to the remote server, remote port forwarding works in the opposite direction. This is helpful when you need to access services or resources. on your local machine from a remote server. These are just a few of the options that can go with the SSH Command. Please note that these are case sensitive. And need to be typed just as they are shown on the screen. There are many more that you can look up by running a man SSH command and going through the manual pages to see all the different options and use case scenarios. The next field is a user field. This part of the Syntax represents the remote username and hostname or IP address of the target server. If you met the user at part SSH wll use your local username. It's important to note that that user account must be on the remote machine that you're connecting to, not the machine that you are currently on. The exception to this is if you are in a domain situation in which all users are configured to be on all devices. The next field we have is the hostname field. The hostname is a remote hostname. Or IP address of the server you want to connect to. You can specify a hostname either in /etc/hostfile, or in a custom user SSH configuration file. This allows for shortcutting and easier access to machines that you may remote into more frequently. The last field is the command field, which is an optional field. The SSH command field is a powerful and versatile feature that allows users to execute. commands on a remote server directly from their local machine. When establishing an SSH connection, users can specify a command that will be executed on the remote server before returning the output to the local machine. For example, if a user needs to check the disk usage on a remote server without initiating a full session. They can use the SSH command field. This command would look like ssh uer@hostname ' df -h", the output would be printed to the screen and the connection would be immediately terminated. Now that we have gone through the basic command syntax, let's try a few examples. First, let's connect to our third ubuntu machine using the user 3@10.10.10.10.103 command. Provide user3 Credentials and now I am logged into the machine. I can run a simple whoami command in a hostname command to verify I am user3 and I am on the ubuntu 3 machine. Let's go ahead and close this connection. Now let's log in to the same machine, for this time, instead of specifying the username, let's specify the hostname. To do this, let's take a quick look at /etc/hostfile. As you can see, there's an entry for the ubuntu 3 machine which can be referenced at ubuntu 3, that test on net or simply ubuntu 3. Now let's go ahead and attempt to connect, with the user 3 And ubuntu 3 Provide the password. And now you can see we successfully logged in by using the hostname instead of the IP address. Now let's connect to our second machine. This machine has been set up to listen on a nonstandard port of TCP 2222. To connect to this machine, it was simply type SSH -p 2222 user2@ ubuntu2 provide the credentials. And now you can see we are logged into the user2 machine at ubuntu2. To verify, I run a whoamii command in the hostname command. I am user2 and I am on the ubuntu2 machine. Now it's close this connection. Lastly, let's try to use a command with our SSH connection. To do this, type SSH -p 2222 user2 @ubuntu2 'cat /etc/password. Cat is simply reading a file, and displaying it to the screen. All these /etc/password file is a user file that shows users on the system, their you ID, home path and log in show Glenn presenter provide user two's credentials and as you can see it displayed the file to our screen. However, if you look at the connection, we are user1 and we are still on our ubuntu1 machine. So the command made the connection, it showed the file to the screen and then terminated the connection. Stay tuned for the next lesson where I will show you how to modify. The user SSH configuration file in order to customize the behavior of SSH connections. Thanks for watching.