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).
Then type Username and Password, after succesfully loggin, you can access to your 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.
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
- Syntax to connect to your Magento server
ssh user@host -pPORT
user
: Server Usernamehost
: Server IP or Host-pPORT
(Optional): SSH Server Port. E.g Port 22 so it is-p22
E.g:
ssh sam@192.168.1.100
That’s all!
I hope this tutorial will be helpful for you. If you have any questions, feel free to leave comments below.
Enjoyed the tutorial? Spread it to your friends!