How to Connect to Magento 2 using Terminal SSH

Using command lines in Magento 2, you have to connect to Magento 2 Server using Terminal or SSH first. In this post, we will guide you quickly to connect to Magento 2 Server for Windows, Mac OS and Linux (Debian, Ubuntu, Centos …).

Connect to Magento 2 Server in Windows

In Windows, there are few ways to connect to the Magento server such as Putty, WinSCP or Git Preview. Today, I use Putty to connect to the Magento server. Open Putty and type Server IP or host and Port (default: 22).

conenct magento 2 server using Putty

Then type Username and Password, after succesfully loggin, you can access to your server.

magento 2 server

Change direct to Magento root folder:

cd /var/www/magento2

In this case, our Magento 2 source code placed in /var/www/magento2, this may be difference from your server.


Magento 2 extensions

Magento 2 extensions

Allow you to achieve more with your online store

Check it out!


Connect to Magento 2 Server in Mac OS, Linux (Debian, Ubuntu, Centos)

By Default, Mac OS and Linux has Terminal tool, you can use this to access to remote Magento server.

  • Open Termnial

terminal

  • Syntax to connect to your Magento server
ssh user@host -pPORT
  • user: Server Username
  • host: Server IP or Host
  • -pPORT (Optional): SSH Server Port. E.g Port 22 so it is -p22

E.g:

That’s all!

I hope this tutorial will be helpful for you. If you have any questions, feel free to leave comments below.

Image Description
With over a decade of experience crafting innovative tech solutions for ecommerce businesses built on Magento, Jacker is the mastermind behind our secure and well-functioned extensions. With his expertise in building user-friendly interfaces and robust back-end systems, Mageplaza was able to deliver exceptional Magento solutions and services for over 122K+ customers around the world.
x