![]() I hope this article helped you in understanding what SSH tunneling is and how we can set up an SSH tunnel using the Terminal in MacOS and in Ubuntu or other Linux-based operating systems. So, for example, we have 2200 port for SSH enabled on our remote server, then the command would be: ssh -L 8888:my-db-server.host:3306 -p 2200 Conclusion: Then we can run the following command: ssh -L 8888:my-db-server.host:3306 If SSH connection is enabled on a different port other than port number 22, then we can specify the port number in the above command using -p argument. If our DB server is my-db-server.host on which port 3306 is available for connection on the private network access to the remote SSH server my-remote-server.host, as shown in the picture below. Connect to Destination server via Remote Server: Next, let's see how to connect to a separate DB server via a remote server. This was the scenario where the DB server was running on the localhost of the remote server. pem file as the SSH key, run the following command for the above scenario: ssh -L 8888:127.0.0.1:3306 -i this case, you will not be asked for the password, as authentication will be done using your SSH key. If your remote server is an EC2 instance on AWS and you have a. Now, you will be able to access the MySQL server using 127.0.0.1:8888 address from your local machine. Once you do this, you will be prompted to enter the password for the user st-user, so enter the password and hit Enter, and the SSH tunnel will be created. and then is the username and the IP address/URI for the SSH server.3306: This is the destination port, assigned to the MySQL server on the remote SSH server.127.0.0.1: This is the IP for the localhost running on the remote server, this is also the destination we aim to reach via the SSH server.Here you can give any port number after 1024, because until 1024 port number, all ports are privileged ports. ![]() ![]() Ssh -L 8888:127.0.0.1:3306 Here, 8888: This is the local port that we will open for the SSH tunnel on the local machine.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |