0

In general, I would like to run local programs on remote files provided to me via a distributed file system (e.g. samba, NFS or whichever you recommend), and I want to access the remote files in a way similar to accessing local files: something similar to "location transparency".

I was amazed by my file manager pcmanfm which can present remote files like local files, and allows me to run some local programs on them by right clicking in the same way of running the programs on local files.

I want to do the same in CLI shell.

For example, I am trying to copy a file to a remote directory sharesmb shared via a remote samba daemon. I can do it in my file manager pcmanfm, with address smb://olive.local/sharesmb on olive.local. I would like to do the same in shell, but the link doesn't work. Could you tell me how to do that in shell?

$ cp 153-158.pdf  smb://olive.local/sharesmb on olive.local
cp: target 'olive.local' is not a directory


$ cp 153-158.pdf  smb://olive.local/'sharesmb on olive.local'
cp: cannot create regular file 'smb://olive.local/sharesmb on olive.local': No such file or directory

Thanks.

Tim
  • 1,487
  • 6
  • 28
  • 43

2 Answers2

1

Generally speaking you would mount the remote file system to a local directory and work on files via that mountpoint. In a Unix-like environment this literally means you access remote files the way you would local ones.

There are multiple options depending on what you want to do, though. Midnight Commander (mc) behaves similar to how you described pcmanfm. If you just want to copy files between machines you might want to look at the scp command, provided the remote hosts run sshd (which since a while back is available for Windows Server 2019 too).

Mikael H
  • 5,031
  • 2
  • 9
  • 18
  • Thanks. How do you mount the remote file system to a local directory in Linux? – Tim Jan 27 '20 at 15:28
  • You use the `mount` command. You need to read up on the specifics depending on the protocol used, and you should read up on how to use it securely (in terms of not typing credentials in clear text at a prompt, and in terms of using protocol security that's appropriate for your environment). – Mikael H Jan 28 '20 at 08:10
0

Use sshfs:
sshfs user@10.0.0.123:/path/to/remote/folder /path/to/mountpoint/

Thanks: https://unixcop.com/mount-a-remote-folder-with-sshfs/

Rublacava
  • 101