Using SSH With InMotion Central

Learn How to Use SSH With InMotion Central

When you are running a website or server, SSH can save you time by allowing you to directly view, manage, and edit files from the command line interface (CLI). In this guide, we will show you how to use SSH with your Cloud VPS hosted with InMotion Central.

Connect to Your Server via SSH

  1. Generate an SSH Key & Add it to your server.
  2. Login to InMotion Central, open your Project, then click Manage Server.
  3. You can then copy your Hostname or IP Address to use for connecting.
    Copy Server Hostname and IP Address
  4. Here are some examples of how you can connect.

    Connect with Hostname:
    [email protected]

    Connect with IP Address:
    [email protected]

    You will then be connected to your Cloud VPS via SSH.
    Connected to Server Via SSH

Using Your Key for SFTP

Once you’ve Generated an SSH Key & Added it to your server, you can also use it for connecting via SFTP. Here are the settings you should use.

OptionSFTP Setting
HostYou can use your Hostname or IP address. You can view this in your project under the Manage Server section.
Usernameroot
PasswordPassword for the SSH Key you generated. In most cases, you should be able to leave this blank. This is due to using the public/private keys.
Port22

For more information, see our full guide on Connecting With SCP and SFTP.

Managing Services

In this section, we will go over the log locations and specific commands for managing services on your Cloud VPS with InMotion Central.

NGINX

Log Files

  • Access: /var/log/nginx/access.log
  • Error: /var/log/nginx/error.log

Start/Stop/Restart

  • systemctl (start|stop|restart|status|reload) nginx
Examples:

Start:

systemctl start nginx

Stop:

systemctl stop nginx 

Restart:

systemctl restart nginx

View Status:

systemctl status nginx

Reload:

systemctl reload nginx

Main Config

  • /etc/nginx/nginx.conf

Site Config

Below is the location of your site’s NGINX configuration file. Be sure to replace vps#### with your actual VPS server number.

  • /etc/nginx/conf.d/vps####.inmotionhosting.com.conf

Apache

Below is the location of your site’s Apache log files. Be sure to replace vps#### with your actual VPS server number.

Log Files

  • Access: /var/log/httpd/ssl-vps####.inmotionhosting.com-access.log
  • Error: /var/log/httpd/ssl-vps####.inmotionhosting.com-error.log

Start/Stop/Restart

  • systemctl (start|stop|restart|status|reload) httpd 
Examples

Start:

systemctl start httpd

Stop:

systemctl stop httpd

Restart:

systemctl restart httpd 

View Status:

systemctl status httpd

Reload:

systemctl reload httpd

Main Config

  • /etc/httpd/conf/httpd.conf

Site Config

Below is the location of your site’s Apache configuration file. Be sure to replace vps#### with your actual VPS server number.

  • /etc/httpd/conf.d/vps####.inmotionhosting.com.conf

MySQL

  • systemctl (start|stop|restart|status) mysql 

Start:

systemctl start mysql

Stop:

systemctl stop mysql

Restart:

systemctl restart mysql

View Status:

systemctl status mysql

Reload:

systemctl reload mysql

Main Config

  • /etc/my.cnf

Extra Config

  • /etc/my.cnf.d/server.cnf

PHP

Log Files

  • Error: /var/log/php-fpm/wordpress-error.log
  • Slow: /var/log/php-fpm/wordpress-slow.log

Start/Stop/Restart

  • systemctl (start|stop|restart|status) php-fpm 
Examples

Start:

systemctl start php-fpm

Stop:

systemctl stop php-fpm 

Restart:

systemctl restart php-fpm

View Status:

systemctl status php-fpm

Main Config

  • /etc/php-fpm.conf

Site Config

Below is the location of your site’s PHP configuration file. Be sure to replace vps#### with your actual VPS server number.

  • /etc/php-fpm.d/vps####.inmotionhosting.com.conf

Redis

Log Files

  • /var/log/redis/redis.log

Start/Stop/Restart

  • systemctl (start|stop|restart|status) redis
Examples

Start:

systemctl start redis

Stop:

systemctl stop redis

Restart:

systemctl restart redis

Main Config

  • /etc/redis.conf

Monit

Monit is an open-source tool that is installed to assist in monitoring and maintaining your server.

Log Files

  • /var/log/monit.log

Start/Stop/Restart

  • systemctl (start|stop|restart|status) monit 
Examples

Start:

systemctl start monit

Stop:

systemctl stop monit

Restart:

systemctl restart monit

Status:

systemctl status monit

Main Config

  • /etc/monit.d/monitrc

Extra Service Config

  • /etc/monit.d/{httpd,mariadb,nginx,php-fpm,redis}

Extra Service Commands

  • monit (status|summary|report|validate)
Examples

View Status:

monit status

View Summary:

monit summary
View Report:
monit report

Validate:

monit validate

Using WP-CLI

Before you can execute any WP-CLI command, you must switch to the WordPress user with the following steps.

  1. Connect to your server via SSH.
  2. Run the following command:
    su - WordPress
  3. You can then use WP-CLI to manage and troubleshoot your site. More information on the available commands can be found at: https://developer.wordpress.org/cli/commands/

Connecting Your IDE/Code Editor

We will now show you how to connect to your Cloud VPS using an integrated development environment (IDE) and code editor. For this guide, we are covering Visual Studio Code (VS Code) and Sublime Text.

Using Visual Studio Code

You will need to download and install Visual Studio Code before following this section of the guide. 

  1. Open Visual Studio Code. If you are running in “Restricted Mode” when you first open VS Code, you can click Manage on top then Trust to enable all features.
  2. Click View then Command Palette. You can also click Ctrl+Shift+P to open the command palette.
    Viewing the Command Palette in Visual Studio Code
  3. Type “remote” in the search box then click the Remote: Install Remote Development Extensions option.
    Searching and Install Remote Development Extensions
  4. You will then see the “Remote – SSH” option listed, click the Install button.
    Installing Remote - SSH in Visual Studio Code
  5. Click View then Command Palette again and type remote in the search box then click Remote-SSH: Connect to Host…
    Connecting to a Host with Remote-SSH in Visual Studio Code
  6. Enter your SSH login info as described above in the section on how to Connect to Your Server via SSH. Then click the Enter key.
    Logging into My Server with Visual Studio Code

    Visual Studio Code will open a new window that is connected to your server. From there you can create a new file, open a file, open a folder, or clone a Git repository. 
  7. In this example, we are going to click Open File to access an Apache configuration file.
    Opening a Remote File with Visual Studio Code
  8. Now I’m going to enter the path to the file I want to open then click OK.
    Searching for a Remote File With Visual Studio Code

    The file will then be open and you can view or edit it as needed.
    Editing a Remote File With Visual Studio Code

Using Sublime Text

You will need to download and install Sublime Text before following this section of the guide. 

  1. Open Sublime Text and click Tools, then Command Palette. You could also click Ctrl+Shift+P to open the Command Palette.
  2. Type install in the search box then click Install Package Control.
    Searching for Package Control
  3. You will then see a message stating “Package Control was successfully installed”. Click the OK button.
    Package Control was Successfully Installed
  4. Now go to Tools then Command Palette and type “package control” then click the Install Package option.
    Installing Package Control
  5. Enter “remotesubl” in the search field then click RemoteSubl from the list. It will be installed automatically once clicked.
    Search and Install Remote Sublime - RemoteSubl
  6. Run the following commands:
    sudo curl -o /usr/local/bin/rmate https://raw.githubusercontent.com/aurora/rmate/master/rmate

    sudo chmod +x /usr/local/bin/rmate

    sudo mv /usr/local/bin/rmate /usr/local/bin/sublime
  7. Logout and back into SSH and include the port, for example:
    ssh -R 52698:localhost:52698 [email protected]
  8. Important: You must have Sublime Text open for the next step to work.
  9. You can then open a file by using the sublime command. For example, I can open the NGINX access log with Sublime text by using the following command:
    sublime /var/log/nginx/access.log

Congratulations, now you know how to use SSH on your Cloud VPS with InMotion Central!

JB
John-Paul Briones Content Writer II

John-Paul is an Electronics Engineer that spent most of his career in IT. He has been a Technical Writer for InMotion since 2013.

More Articles by John-Paul

Comments

It looks like this article doesn't have any comments yet - you can be the first. If you have any comments or questions, start the conversation!

Was this article helpful? Let us know!