简体   繁体   中英

Add bin PATH from other machine

I want to make a program on machine A. However the Makefile call a program from machine B.

How should I define or link the PATH from machine B to machine A? Is there any way to mount a folder from machine B to machine A as a disk, then add PATH?

Thank you.

You mixed two questions together: how to copy (or mount) a file (or directory) from a remote host, and how to set PATH to let your Makefile find it.

For the first one: TLDR, you should use sshfs or scp. Long version of available options:

  1. sshfs: The quickest way. It just establishes a SSH connection to your B host, so it doesn't require any special server besides SSH. However, it uses FUSE, so it is slower. No root required, since it is a per-user solution.

  2. NFS: NFS requires some work to setup, but once you get it working, it offers seamless integration with your system. In order to get most out of NFS, you need to setup LDAP, Kerberos and NFS ID Map, even though unencrypted anonymous NFS still works. Then you need to mount your NFS server to a system wide mountpoint. Finally, you can just work on that mountpoint and it is just like your local hard drive: permissions just work. Requires root, since it needs to be mounted globally. Personally thinking, I do not recommend you to use this approach since it is too complex for your requirements. A recommended usage would be shared /home drive.

  3. scp: Use scp to copy a single file from your remote host without mounting a sshfs FUSE filesystem. This is quick as well.

  4. SMB: I haven't used it a lot, but it is as complex as NFS, and its permission integration is not as seamless as NFS. Be warned that it requires lots of effort to deal with, especially with permissions.

  5. FTP / HTTP / ...: All works and they are easier than SMB or NFS, but still hard to setup (you need to setup a separate server) than sshfs or scp.

Complexity: SMB > NFS > FTP / HTTP > SCP / SSHFS (best fits in your requirement)

For the second question, once you copied the binaries to your local host, or mounted a remote directory to a local mountpoint, you can just set your PATH environment variable to something like </directory/of/mountpoint/or/parent/directory/to/the/binary>:$PATH . This can be done in Makefile or shell scripts (eg export PATH=appended_path:$PATH ).

Hopefully it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM