I am writing some automation API in C working with remote file system via SSH.
The host is running Ubuntu-Linux and one of the target machine is running Windows 7 with OpenSSH installed.
The specific function I am having trouble with is to list the files in the remote Windows system. In particular, those files and folders with space in their names. For example: "Foo BAR"
The format of my command looked like this
sshpass -p [pwd] ssh [account]@[ip_addr] dir PATH
If I do:
sshpass -p [pwd] ssh -v [account]@[ip_addr] dir C:\"FOO BAR"
With verbose(-v) option, it gives me the following response(snippet):
debug1: Sending command: dir C:"Foo BAR Volume in drive C has no label. ... File Not Found
If I do:
sshpass -p [pwd] ssh -v [account]@[ip_addr] dir C:\\\"FOO BAR\"
debug1: Sending command: dir C:\\"FOO BAR" Volume in drive C has no labe. ... File Not Found
When I run it through automation, it will return:
sh: 1: Syntax error: Unterminated quoted string
My API works perfect for those filenames with no spaces in between. Seems like a limitation sending commands as such to windows system. Any ideas how to resolve this?
Thanks for the reply warl0ck! I wasn't aware of this SSHFS, gonna give it a try first.
Following the link you provided, during this step:
sudo sshfs -o allow_other,defer_permissions email@example.com:/ /mnt/droplet
I got the following error:
fuse: unknown option `defer_permissions`
After asking google, I changed it to:
sudo sshfs -o allow_other,default_permissions firstname.lastname@example.org:/ /mnt/droplet
Then I ran into the following error:
read: Connection reset by peer
I followed through this Connection reset by peer using sshfs and did:
sudo usermod -a -G fuse [my_user_name]
But I still got the same issues, any ideas?