Download a file from a remote server in ruby.
require 'kanrisuru' host = Kanrisuru::Remote::Host.new(host: 'centos-host', username: 'centos', keys: ['~/.ssh/id_rsa']) host.download("/etc/hosts") "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\n127.0.1.1 centos-host\n::1 localhost localhost.localdomain localhost6 localhost6.localdomain6\n\n"
This command might need escalated privlidges to access certain files that have file permissions set for root access.
||Required path to download a file / directory|
||Optional path to specify where to download. If local_path parameter isn't present, the result will be the file itself.|
||Should download a remote directory and recursively download all of it's subdirectories|
||The atime and mtime of the file should be preserved.|
Either returns the contents of the file that was downloaded if no local_path was present, or the local_path if a file or directory was downloaded successfully.
- Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES