# Addressing windows files from FreeBSD?



## gabier (Oct 22, 2011)

Hello,

Probably another newbie question, but maybe not. If connectivity is established between a FreeBSD (called the Server) and a windows computer (called the Remote), I could run a network command from the Remote because I installed Cygwin. The command (for instance scp) is of the form 
	
	



```
scp /Cygdrive/E/Windowsuser/"My Documents"/xyz freebsduser@server:dir/abcd
```

I ran it and it works. But if the remote has not Cygwin installed, I would rather wish to run the command on the server. The command would be of the form 
	
	



```
scp Windowsuser@remote:???????? dir/abcd
```

But what is ????????. 

Is it possible (I would be surprised if it is not) , and if yes what is the syntax? I could find this anywhere. If you wonder why I want this information, it's because I want to run RSync on the server to backup several windows computers.

 Gabier


----------



## geodni (Oct 22, 2011)

Your remote machine will respond the scp command by having a SSH server installed and running on it. Why not use smbclient or FTP (install a FTP server on the remote) ?


----------



## gabier (Oct 22, 2011)

geodni said:
			
		

> Your remote machine will respond the scp command by having a SSH server installed and running on it. Why not use smbclient or FTP (install a FTP server on the remote) ?


Thank you geodni
Would other commands asking for files (ie rsync) be also understood by those clients?


----------



## freethread (Oct 22, 2011)

In PuTTY distribution archive the pscp executable can be used if cygwin is not installed (there is also psftp). In addition you can use it in  a batch script, user and password can be set on the command line


```
pscp -pw passwd X:\path\to\srcfile user@host:/path/to/dstfile
```

Another way is to use dokan (ssh file system, sshfs) on your "remote" system, it does not work on all os versions and configurations (windows only).

To be able to scping from your "server" to "remote", "remote" must be run a ssh daemon (cygwin or other specific apps).


----------



## geodni (Oct 22, 2011)

FileZilla is also available as server under Windows. I didn't tested it, only client part.
I've only used Putty suite to make scripts being run by "at" command under Windows using dedicated Unix user with an empty SSH passphrase combined with /etc/hosts.allow to restrict access. Configuring /etc/ssh/sshd_config  with Match and ChrootDirectory directives can improve security. In earlier OpenSSH, user home path in /etc/passwd containing a "." (dot) like /home/./geodni meant it's chrooted, but I don't know if such a possibility is still usable today.


----------



## gabier (Oct 23, 2011)

Hello,
Thak you for all advices.
If I understand correctly, anyway I have to install something on the windows remote. I had hoped that freeBSD would be more friendly with Windows that it is. But I have to cope with it!
So now I try to scp from the freebsd server to a remote with cygwin and openssh installed. It works if the command is issued by the remote in the cygwin environment, but it does not work when issued by the server, because there is something wrong in my ssh config there.
When I issue the scp command I get

```
/etc/ssh_config: line 1: Bad configuration option: SyslogFacility
/etc/ssh_config: line 3: Bad configuration option: UseDNS
/etc/ssh_config: line 4: Bad configuration option:SubSystem
/etc/ssh_config: line 7: Bad configuration option:PermitRootLogin
/etc/ssh_config: line 8: Bad configuration option: AllowTcpForwarding
/etc/ssh_config: terminating, 5 bad configuration options
```
 I tried to look at the ssh_config file and I found

```
SyslogFacility LOCAL3
Protocol 2
UseDNS no
Subsystem       sftp    /usr/libexec/sftp-server
ChallengeResponseAuthentication no
Port 22
PermitRootLogin yes
AllowTcpForwarding no
PasswordAuthentication yes
RSAAuthentication yes
PubkeyAuthentication yes
```
I don't know how to fix this problem, because if I search for ssh_config on man pages
for instance 
http://www.freebsd.org/cgi/man.cgi?...ion=0&manpath=FreeBSD+7.3-RELEASE&format=html
I find only one or 2 of these options.
Maybe I should start another thread for this problem. Maybe also I should ask this question on the Freenas forum because I enabled the ssh service trough the Freenas GUI and probably Freenas did not prepare the service correctly.

 Gabier


----------



## geodni (Oct 23, 2011)

It's not clear...
Are you talking about /etc/ssh/ssh_config for ssh client system-wide in your server (FreeBSD) or in your remote (Windows), or are you talking about /etc/ssh/ssh*d*_config for sshd server system-wide in your server (FreeBSD) or in your remote (Windows) ?
Your link points to ssh*d*_config man page and not ssh_config which is not the same.
Prefix your ouputs with the host type Server and/or Remote and pay attention to the exact terms you use.


----------



## gabier (Oct 23, 2011)

geodni said:
			
		

> It's not clear...
> Are you talking about /etc/ssh/ssh_config for ssh client system-wide in your server (FreeBSD) or in your remote (Windows), or are you talking about /etc/ssh/ssh*d*_config for sshd server system-wide in your server (FreeBSD) or in your remote (Windows) ?
> Your link points to ssh*d*_config man page and not ssh_config which is not the same.
> Prefix your ouputs with the host type Server and/or Remote and pay attention to the exact terms you use.


Sorry for the wrong link to the man page. I am talking indeed of the /etc/ssh/ssh_config on the FreeBSD server. The error lines were not prefixed in the console screen but I was logged as root@server

 Gabier


----------



## gabier (Oct 23, 2011)

I confirm that the first test was made from the remote but logged in the server as root. That means that the error is on the FreeBSD server.
I can add that I made 2 additional tests: 
1) a test logging in as the server user who uses ssh and for which maybe it was configured
2) a test with a keyboard and a screen directly on the Freebsd server (in fact FreeNAS has an option "Shell", I suppose it is the FreeBSD shell). The prompt is # so I suppose I am logged in as root. Quite awkward because it does not recognise my azerty keyboard, but I managed to run the scp command
In both cases the server scp command asked for a transfer of a file from the remote to the server, and in both cases I had the same error that I reported before. The command is not launched because of ssh_config too many errors.

Gabier


----------



## geodni (Oct 23, 2011)

How did the ssh_config file was done ? Was it already on your Server or did you make it yourself ?
I say that because directives comes from a sshd_config file and all in make it looks like a tiny but usable SSH daemon config file. Retry your transfer after renaming your supposed ssh_config to something like ssh_config_DISABLED. Check if sshd_config still exists.


----------



## gabier (Oct 23, 2011)

geodni said:
			
		

> How did the ssh_config file was done ? Was it already on your Server or did you make it yourself ?


I did not make any file myself. It was there. But maybe I issued a wrong command at some point of my tests. Because I am very very bad. See below.


			
				geodni said:
			
		

> Retry your transfer after renaming your supposed ssh_config to something like ssh_config_DISABLED. Check if sshd_config still exists.


I ran the following wrong command I thought it would rename the file
[cmd=]mv ssh_config ssh_config_DISABLED[/cmd]
But it deleted the first one and dispayed an error message: 
	
	



```
ssh_config_DISABLED no such file or directory
```
Result: when I retry the transfer: 
	
	



```
Error : the name of the remote host could not be resolved
```
I am afraid that for the moment you should give me the complete command to execute, or else its unpredictable. 
BTW how could I redirect the console output to a file so that I can copy here the output more easily?
Thanks indeed for your patience.

 Gabier


----------



## gabier (Oct 23, 2011)

Sory for this new post but I cannot yet edit my posts. I replaced the hostname by the ip in order to avoid the necessity of resolution, but then the connection was refused by the remote;

gabier


----------

