Transfer file from desktop machine to remote server
How to transfer files from the user's desktop to remote servers using Ezeelogin jump server ?
This feature is available from Ezeelogin version 7.30.0. Refer below article to upgrade the current Ezeelogin installation to the latest version.
Upload Files from your Desktop to remote servers via Ezeelogin GUI
Click on the File Upload icon and choose a file from the client machine. Provide a Remote Path where the file needs to be copied and then click on the Upload button.
File upload can be done in the directories where users have the privilege. The remote user can be specified in Edit Server -> Remote SSH login user / RDP login user
Download Files from the remote servers to your desktop via Ezeelogin GUI
Click on the File download icon and provide the Remote Path where the file is located and then click on the Download button.
How to grant privileges for gateway users to transfer files to the remote servers?
1. Allow users to access the servers. Refer to the below screenshot.
2. Edit privilege for that user and allow Web File Transfer to enable File Upload for that user. Refer below screenshot.
Common errors in Ezeelogin GUI while Uploading/Downloading files.
View detailed error messages on the application log. Tail the latest log and see the mess
root@gateway ~]# echo "log_level trace" >> /usr/local/etc/ezlogin/ez.conf
root@gateway ~]# cd $(awk '/^system_folder/ {print $2}' /usr/local/etc/ezlogin/ez.conf)/application/logs/
root@gateway ~]# tail log-20xx-xx-xx.php
1. Error: Remote file open failed
The above error occurs when the remote SSH user has no privilege to write on the specified remote path.
2. Error: SSH authentication failed
a) The above error occurs when the gateway server is not able to connect to the remote server with the remote username specified while adding the server.
b) The servers added with the key will show the above error (only in specific PHP versions).
3. {"status":"error","data":"Remote file does not exist"}
When attempting to download a file, if the remote file path provided is incorrect, the above mentioned error occurs. Make sure the remote path given is correct.
3. Error: An error occurred while trying to send data: error (Forbidden)
To resolve the above error, you can increase the values for max_execution_time, memory_limit, post_max_size, and upload_max_filesize in the php.ini file. Refer below step.
How to find PHP memory limit, max execution time, post max size, and upload max file size?
root@gateway ~]# grep -v '^\s*#' /etc/php/8.1/apache2/php.ini | grep -i 'max_execution_time\|post_max_size\|upload_max_filesize\|memory_limit'
max_execution_time = 300
memory_limit = 1G
post_max_size = 1G
upload_max_filesize = 1G
root@gateway ~]# grep -v '^\s*#' /etc/php/8.1/cli/php.ini | grep -i 'max_execution_time\|post_max_size\|upload_max_filesize\|memory_limit'
max_execution_time = 300
memory_limit = 1G
post_max_size = 1G
upload_max_filesize = 1G
How to view detailed logs of file uploads done by the gateway users?
Login to Ezeelogin GUI and navigate to Users -> Web Activity. Select Gateway user from User and Servers from Section.
1. In the below example, ezadmin user uploaded the file ssh2-1.3.1.tgz to the remote path /root/ssh2-1.3.1.tgz of the server production.server.
2. In the below example, alex user tried to upload a file to the remote path which has no access. Error message "Remote file open failed".
Some PHP versions have issues when using key-based authentication. Change key-based authentication to password-based to fix the error "Error: SSH authentication failed".
In order for key-based authentication to work, make sure to install libssh version 1.10.0. Refer below article to compile and install libssh version 1.10.0.
How to compile and install libssh (1.10.0) and php-ssh2 (1.3.1)?
1. Install ssh2 PHP module using the below command (replace PHP version).
root@gateway ~]# apt update ; apt upgrade
root@gateway ~]# apt install php7.4-ssh2 -y
Make sure php-ssh2 version is greater than or equal to 1.3.1. Run below command to check php-ssh2 and libssh versions.
root@gateway ~]# dpkg -l | grep ssh
root@gateway ~]# php -i | grep -i ssh
2. Add php-ssh2 extension in php.ini (replace PHP version).
root@gateway ~]# echo "extension=ssh2.so" >> /etc/php/7.4/cli/php.ini
root@gateway ~]# echo "extension=ssh2.so" >> /etc/php/7.4/apache2/php.ini
3. Restart the apache webserver and access Ezeelogin GUI.
root@gateway ~]# systemctl restart apache2