With SSH access, you can work with your files and directories securely, connecting from an application or command-line interpreter. Below we provide an example of a command-line interpreter for each of the most commonly used operating systems:
1.-Activate the SSH connection
To connect to the server you must enter the SSH access credentials. You can view these details in the SSH access icon within the hosting management in your cdmon control panel.
Open the command terminal, where you must enter the following syntax to connect to the server:
ssh username@server_IP or server_name
An example connection using the data from the previous screenshot:
Next, it will ask for the password. You must type the password you set when activating SSH access in your control panel.
When the connection is established, you will see the terminal with the following format:
You can start working with your default folder, which by default will be /entrada. You can check your location at any time using the pwd command:
If you are in the /entrada folder and want to access the management of your website files, you must exit the /entrada folder with the command:
cd ..
Once outside, you can access the /web folder with the command:
cd web
Located in the /web folder, you can view all the directories and files of your website by using the command ls -la. With this command you will obtain results similar to the following:
2.-Basic commands
Below is a list of the basic commands for working with files using an SSH connection:
cd: the path you want to access.
ls: lists the contents of all files and directories.
rm: deletes a file.
mkdir: creates a new directory.
rmdir: deletes a folder.
pwd: shows the location of the current path.
cp: copies a file to another directory.
mv: moves files between folders.
more: if you perform a search with many results, this command allows you to view the results in sections.
unzip: extracts compressed files.
ftp: connects to upload/download files from your local computer to the server.
mysql: allows you to work with databases and perform exports/imports of content.
exit: exits the remote machine you are connected to.
clear: clears all the information displayed on the screen.
3.-SSH user permissions
When you start working with the SSH user, you must control the permissions assigned to each directory, since folders created via FTP or SSH have the same user and belong to the same group.
Below is an example of a folder created by FTP and another created by SSH:
Assign permissions 775 to the directories:
With this modification, you can work with the same directory from both SSH and FTP.
Note: when SSH is activated, the owner of the /home folder of your hosting is modified.
This prevents creating directories in the root of the site through FTP. You can create directories inside the /web folder.
What commands can I use from SSH?
If you press the tab key twice, the command console will show all the commands available with your SSH user: