I need a command line to list all the image files that are stored in another server. I have username, pasw, ip and port. However, code below doesn't work. Either with php or command line will be accepted.

Thanks in advance

$pathToImages = root:123123@ /var/www/vhosts/pictures/
7 Years
Discussion Span
Last Post by veledrom

You can execute a remote command on another system via ssh. However most smart sysadmins disable remote login as root. You have to connect to the system first then switch to root.

If root access is enabled the ssh command would be:

[rod@srvr4 ~]$ ssh rod@ ls -la /tmp
The authenticity of host ' (' can't be established.
RSA key fingerprint is 53:58:25:cc:5d:53:41:ed:03:80:47:68:e8:1c:a4:2a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
rod@'s password:
total 144
drwxrwxrwt 26 root root 4096 Jul 4 05:40 .
drwxr-xr-x 30 root root 4096 Jul 3 09:28 ..
srwxrwxrwx 1 clamav clamav 0 Jun 24 02:42 clamd.socket
drwx------ 2 root root 4096 Jun 26 18:39 .exchange-root
drwxrwxrwt 2 root root 4096 Jul 3 09:29 .font-unix
drwx------ 3 rod rod 4096 Jul 2 18:55 gconfd-rod


You would have to supply the password but the key confirmation would only be in the first connection.


I need to do it in a php script. That is the problem. Script will connect to server and fetch the files inside a folder. Is there any way of doing it?


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.