Is there a way to put URL of a file instead of a file in parameters of a linux command?

To be specific I am looking for a way to store dhcp.lease file remotely but dhcp accept just file. How can I do someting like this:


As I searched links does not work.


You can accomplish this - running a local daemon with a remote config file - by using something like sshfs, which mounts a remote directory securely:

sshfs USER@IP_ADDR:/path_to_file/ local_dir/

(To avoid a password prompt, use the public/private key system.)

But doing this would make the daemon less reliable, which is generally something to avoid. You may want to consider a synchronization mechanism instead.

  • this way just ssh is supported how about other protocols? – Hojat Modaresi Dec 6 '15 at 9:25
  • There are 3rd party products that can simulate a mount over FTP, but it's a bad idea. FTP is not secure and far less stable than ssh. – xdmag Dec 6 '15 at 9:38

To use the result of a command in bash you can use "$(command)" as placeholder.

In your case the command has to fetch a file with ftp and has to put it locally, then reference that local copy without interactive parts.

It is probably easier to write a full script in your use case.

  • This sounds nice, but how about the situation when dhcp wants to write to dhcp.lease file remotely? – Hojat Modaresi Dec 6 '15 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.