Communication with Windows computers

Hello everybody,

To those who read about the horrible mess I had put in my ssh part of FreeBSD, I paid for my sins and I reinstalled everything. Now I can log into my FreeNAS/FreeBSD computer and send commands from there to other computers. And the problems are back too. I am searching a tutorial on how to tune a Windows 7 (64 bits) system so that I can connect to it from a FreeBSD system. Because I can't even connect to the Windows computer. Suppose I want to transfer a file from the Windows computer (remote) to the freebsd server (server).

Code:
$ ssh user@server
user@server.local's password : 
last login ...
Welcome to server

$ scp User@remoteIP:path1/file1 ~/path2/
ssh : connect to host remoteIP port 22 : Connection refused

Why is that, not even a password prompt?

:) Gabier
 
Hi,

For windows user you should install WinSCP, otherwise follow up with "wblock" conclusions:
Because the "remote" system is not running sshd.

Hint: scp(1) parameters are like cp(1), from and to.
 
akil said:
Hi,

For windows user you should install WinSCP, otherwise follow up with "wblock" conclusions:

Cygwin is installed, it includes OpenSSH (which I use to send commands to the server from the remote) and scp. I doubt the problem comes from this direction. I suspect incompatible options between the two systems, but I don't know what they are.

:) Gabier
 
Cygwin and FreeBSD both use OpenSSH, and they should certainly be able to communicate when using the default option. I frequently ssh from one to the other and back again. A "Connection refused" error means that either ssh isn't running on the IP address or perhaps there's some firewall sitting between the two machines.

Adam
 
gabier said:
Cygwin is installed, it includes OpenSSH (which I use to send commands to the server from the remote) and scp.

That means you are using the ssh/scp client programs on Windows to copy files from Windows to FreeBSD.

You need to start the OpenSSH server program on Windows in order to copy files from FreeBSD to Windows using scp.

I doubt the problem comes from this direction. I suspect incompatible options between the two systems, but I don't know what they are.

More like confusion around the difference between the OpenSSH client (ssh/scp/sftp) and the OpenSSH server (sshd), and where you need to run each one. :)
 
phoenix said:
That means you are using the ssh/scp client programs on Windows to copy files from Windows to FreeBSD.
Sorry, but I login into the server (FreeBSD) from the remote (Windows) with open ssh. Then I issue the scp command (which should run on the server) with source "server" and destination "remote". It seems to me it is the way I intend to move the file
EDIT : sorry, it is rather source "remote" and destination "server". This time it is the way I wish.

phoenix said:
You need to start the OpenSSH server program on Windows in order to copy files from FreeBSD to Windows using scp.
More like confusion around the difference between the OpenSSH client (ssh/scp/sftp) and the OpenSSH server (sshd), and where you need to run each one. :)
The open ssh server is indeed running. It is in the list of Windows services. The name is "Cygwin sshd", it is in the automatic category (started at system startup).

:) Gabier
 
gabier said:
Sorry, but I login into the server (FreeBSD) from the remote (Windows) with open ssh. Then I issue the scp command (which should run on the server) with source "server" and destination "remote". It seems to me it is the way I intend to move the file
Start scp(1) directly from the FreeBSD machine. There's no need to first ssh(1) into the Windows machine to scp(1) to it.
 
SirDice said:
Start scp(1) directly from the FreeBSD machine. There's no need to first ssh(1) into the Windows machine to scp(1) to it.
No keyboard on the FreeBSD machine. Not very convenient.;) Even If I use my only keyboard it is an AZERTY one. The same with the screen, although at the moment I have a little screen attached to it, only in the test period.
I indeed would like to drive the FreeBSD server from the Windows remote.

:) Gabier
 
Now I'm confused. Why don't you use PuTTY and WinSCP from Windows. There's really no need for cygwin or a running SSH daemon on windows.
 
SirDice said:
Now I'm confused. Why don't you use PuTTY and WinSCP from Windows. There's really no need for cygwin or a running SSH daemon on windows.
Maybe I am wrong, because my knowledge is (very) limited. I installed Cygwin because when the network is debugged, I want to use RSync and Cron jobs on the freebsd server in order to schedule files backups from the windows computer (and other computers through it) to the freebsd server.
I had understood that in order to do that, you have to install cygwin. And Cygwin is quite interesting and powerful. You can choose the packages you need, and you get the linux features tailored to your needs on top of a windows system. But of course if there is something more simple ...

And the question why my command does not work remains ...

:) Gabier
 
Cygwin should work, although I haven't tried sshd with it. Could be the helpful Windows firewall automatically blocking it, or maybe the service not being started.
 
wblock@ said:
Cygwin should work, although I haven't tried sshd with it. Could be the helpful Windows firewall automatically blocking it, or maybe the service not being started.
The Windows firewall is disabled.
The ssshd service appears in an unusual state in the services list when I execute "services.msc". Its properties exhibit the "Automatic" property (then it is indeed started at system startup), but the "State" column does not say that it is started. If I manually start it, the system warns me that the service has been started, but that it has stopped immediately as some services do when they have no work. Nevertheless, it is the only "automatic" service in the list which is not permanently started.
Maybe there is a sshd parameter somewhere in order to keep it awaken, or does it awake automatically when a command comes in ?

:) Gabier
 
wblock@ said:
Cygwin should work, although I haven't tried sshd with it. Could be the helpful Windows firewall automatically blocking it, or maybe the service not being started.
You are right, wblock, sshd is not running, I am sure now, because I found it in the Cygwin directories, and I started it at the command line.
Code:
$/usr/sbin/sshd.exe
Could not load host key: /etc/ssh_host_rsa_key
Could not load host key: /etc/ssh_host_dsa_key
Could not load host key: /etc/ssh_host_ecdsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.
It is clear, it aborts as soon as it is started.
These keys it is searching and which don't exist are remains of the preceding installation and a passwordless login implementation. I thought that reinstalling all Cygwin packages would clean up everything, but obviously it did not.
i am now searching for a mean to uninstall Cygwin completely before reinstall.

:) Gabier
 
wblock@ said:

Thanks for the link, wblock. But I have reinstalled Cygwin completely and now I have no more keys loading problems; The sshd service was lacking an sshd_config and I discovered I had to run ssh-host-config. Now my sshd starts OK and does not abort immediately. But my SCP command is not yet through, because now I have password problems.

I issued an scp command from the FreeBSD server as follows (first, login and second scp command asking to transfer "testfile.txt" from the windows computer at 192.168.1.103 to the FreeNAS server).
Code:
$ssh gabriel@freennas
Password etc... Welcome... OK
$scp gabriel@192.168.1.103:/cygdrive/E/gabriel/testfile.txt  ~/gabriel/testfile.txt

Now the connection is established but there is a password problem

Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password,keyboard-interactive).
The two users who communicate have the same name gabriel and the same password, but this password is denied. Is this a known problem and how can I debug it ?

:) gabier
 
gabier said:
No keyboard on the FreeBSD machine. Not very convenient.;) Even If I use my only keyboard it is an AZERTY one. The same with the screen, although at the moment I have a little screen attached to it, only in the test period.
I indeed would like to drive the FreeBSD server from the Windows remote.

In that case, you are over-complicating things.

You are logged into / sitting in front of the Windows machine. You want to transfer files from the FreeBSD machine to the Windows machine. Correct?

Then just install WinSCP on the Windows machine. Use that to connect to the FreeBSD machine. It gives you a very familiar two-paned view (local machine on left, remote machine on right) where you just drag/drop files between machines.

WinSCP connected to the FreeBSD machine using SSH (either via scp or sftp, depends on the settings).

No need for all the extra logins and bouncing around. :)
 
gabier said:
Maybe I am wrong, because my knowledge is (very) limited. I installed Cygwin because when the network is debugged, I want to use RSync and Cron jobs on the freebsd server in order to schedule files backups from the windows computer (and other computers through it) to the freebsd server.
I had understood that in order to do that, you have to install cygwin. And Cygwin is quite interesting and powerful. You can choose the packages you need, and you get the linux features tailored to your needs on top of a windows system. But of course if there is something more simple ...

And the question why my command does not work remains ...

Save yourself a lot of headaches, and just don't bother trying to do things that way (getting FreeBSD to connect to Windows to do backups). I spend quite a bit of time on this last summer/fall trying to get a FreeBSD machine to connect to a Windows machine to back it up via rsync. Tried cygwin versions of sshd/rsync, standalone versions of each, various other combinations, just didn't work.

A better, easier, simpler solution is to either:
  • install the rsync.net application on Windows, configure it to connect to the FreeBSD machine via SSH, and then schedule it to run automatically, or
  • install Samba on the FreeBSD machine, share a directory, mount the directory on the Windows machine, and use Windows tools to do the backup to that directory
 
phoenix said:
In that case, you are over-complicating things.
You are logged into / sitting in front of the Windows machine. You want to transfer files from the FreeBSD machine to the Windows machine. Correct?
Not correct: I want the opposite way. And as I explained higher here to SirDice, I wish, when all this is debugged, to run cron jobs on the server in order to schedule Rsync backups of the Windows machine (and of other computers through it) to the freebsd/freenas server.

:) Gabier
 
wblock@ said:
Normally you would generate a key to avoid passwords at all, using ssh-keygen(1) and putting the public key in the remote system's ~/.ssh/authorized_keys file. (The remote system here is the Windows/Cygwin machine. Note that the user name is the Windows user name.)
See the Handbook section on OpenSSH.

Yes, I have done that on the preceding installation, but this is how I put a horrible mess in the system. I must be very careful before trying this again.
As commands will come from the freebsd server and go to the Windows remote in order to get the files from it, I suppose I should run the keygen command in the freeebsd system and not in the cygwin pseudo system, and then transfer the public key to the remote cygwin. Is that it ? And once this is done, there could be passwordless login both ways ?

As for the user name, anyway, on my Windows system, the login pâssword for the user is the same as the internal password for the other tasks, and the home directory is the same name as the only user, which is also administrator. I don't see how there can be any confusion, but this is it !!

:) Gabier
 
I have sshd running on Windows and it works but I don't use it from ages, the service is disabled. Read cygwin documentation on cygwin site, if I remember I followed the instructions there to install it. FreeBSD has nothing to do with your problem, ssh works as is. Try to reinstall cygwin and follow the instructions, if I'm right a sshd user must be created on windows in order to make it works. This user is used internally by cygwin, it will not be the user you specify to login to the system.
 
gabier said:
Not correct: I want the opposite way. And as I explained higher here to SirDice, I wish, when all this is debugged, to run cron jobs on the server in order to schedule Rsync backups of the Windows machine (and of other computers through it) to the freebsd/freenas server.

Read the rest of my post (or the post after that). You do not want to do what you think you want to do. :) It won't work.

Although I'd love to be proven wrong. :D We have several Windows servers that we'd love to backup via a centralised pull method from a FreeBSD machine, especially if the backups can be used to properly recover a working Windows machine. So far, I have not found a way to make that work.
 
:beergrin it works!!

It was not a password problem but an uppercase problem in the Windows user name; It is "gabriel" on the FreeBSD side and "Gabriel" on the Windows side. I tried to change the Windows user name to "gabriel" and it seemed to have worked, but apparently Windows does not like this kind of familiarity ;)

Being careful with these lowercase/uppercase problem, I ran SCP commands both in the cygwin environnment and in the FreeBSD system, transferring in both cases files from the remote Windows to the FreeBSD server.

I will now consider the passwordless logins and proceed to implement my project. For Phoenix, I do not think my goal is as difficult as the one he is thinking of, because I have to backup computers at hours when they do not work. There are a few problems with "always working" programs, for instance Outlook, but there are turnarounds.

Thank you for everybody's help

:) Gabier
 
Back
Top