Rsync from Linux to Windows SFTP Server - linux

I'm trying to sync documents to an Windows SFTP server via RSYNC on a Linux Machine.
This is my command
rsync -e ssh /home/antony/Documents/Test user1#172.20.1.18:Test
This is the error
exec request failed on channel 0
rsync connection unexpectedly closed (0 bytes recieved so far)[sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.0]

The above may happen for several different reasons.
Maybe the SSH subsystem of rsync is refusing the server key, but this is unlikely because from your description seems like the server is "cutting" the connection, not the client.
Another possibility is that there is no SSH/SFTP server listening on the default port on 172.20.1.18
Or maybe password authentication is not enabled on the server, and you need to authenticate via PKI using a key that you (on the client side) do not have...
In any case, the best thing to do is to double check with the administrator who has configured the server side.

Related

Get all supported KexAlgorithms of an sftp server

I try to connect with an sftp server using the nodejs package https://github.com/mscdex/ssh2.
In the section "serverHostKey" they list all available host key formats.
I try to connect with a new server, but no matter which format I choose, I cant establish a connection because the format/algorithm is not supported.
Is there a way - a command for the command line - , to see which formats/algorithms a certain server supports?
I already tried WINSCP (shows me only the format WINSCP uses), Putty (same as WINSCP)-
https://superuser.com/questions/868998/how-can-i-find-a-list-of-macs-ciphers-and-kexalgorithms-that-my-openssh-client
The second answer of this question, is the answer of my problem.
ssh USER#HOST -p PORT

rsync ssh fails to connect

When trying to connect via rsync to download a file using the following command:
rsync -Pav http://some.domainname.com/file.tar.gz
The following error is given to me
ssh: Could not resolve hostname http: Connection timed out
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(605) [Receiver=3.0.9]
If i try and download the same file using the ftp commands instead it works fine. If i try and use the rsync command from a pc on another network instead this also works fine, so it seems to be something environmental.
The customers client pc sits behind a proxy server, but all the proxy address details have been added to the system, and i'm able to browse, ftp, and ssh onto a test server without any issues. Is there anything that may be blocking rsync from running?
You are mixing curl/wget and rsync.
wget http://some.domainname.com/file.tar.gz
or
rsync a_user#some.domainename.com:/path/to/webdir/file.tar.gz /local/dest/dir

SSH Secure Shell Tunnel X11 - Display not shown

I am using SSH Secure Shell to connect to a server. My connection is allowed to Tunnel X11 connections but when I execute the command. The display is not showing up. I get the message:
couldn't connect to display "localhost:12.0"
I have a ssh server installed and running on my machine.
Remember: Both the client and the server have to allow X forwarding.
On the server look in /etc/ssh/sshd_config and make sure you have X11Forwarding yes. You will need to restart the service if you edit this file.
On the client look in /etc/ssh/ssh_config (your user ~/.ssh/ssh/config will override global settings, if you have created this file) and make sure you have ForwardX11 yes.
Alternatively give the -X switch when you create your client connection. e.g. ssh -X user#host
Oh and of course, your client needs to be running an X server which you have authority to use! E.g. if you connect from Windows using PuTTY it will never work, as Windows is not an X server!
I figured it out. I needed to have X-Server installed on my computer instead of SSH-Server. I installed Xming for that purpose and now everything works as it should.

gitolite: PTY allocation request failed on channel 0

Both jenkins (the ci-server) and my git repository are hosted on the same server. The git repo is controlled by gitolite. If I access the repository from outside, for instance from my workstation I get
ssh git#arrakis
PTY allocation request failed on channel 0
hello simou, this is git#arrakis running gitolite3 v3.0-12-ge0ed141 on git 1.7.3.4
R W testing
Connection to arrakis closed.
Which is fine I guess (besides the PTY... warning)
Now back to the server, I'd like jenkins to be able to connect to my git repository as well.
jenkins#arrakis:~> ssh git#arrakis
gitolite: PTY allocation request failed on channel 0
Logging onto arrakis as user git (the gitolite user):
git#arrakis:~> cat ~git/.ssh/authorized_keys
command="/home/git/gitServer/gitolite/src/gitolite-shell jenkins",no-port-forwarding,no-x11-forwarding,no-agent-forwarding,no-pty ssh-rsa <PUBLIC-KEY> jenkins#arrakis
The "no-pty" entry made me suspicious, so I removed it from authorized_keys and tried again:
jenkins#arrakis:~> ssh git#arrakis
hello jenkins, this is git#arrakis running gitolite3 v3.0-12-ge0ed141 on git 1.7.3.4
R W testing
Connection to arrakis closed.
This solves my issue at this point, but I'm not sure about the consequences of removing "no-pty".
And why does it only affect the local access, since the remote access doesn't seem to be affected at all?
openSUSE 11.4 (x86_64)
VERSION = 11.4
CODENAME = Celadon
The difference in behavior between your workstation and your server is likely due to using different versions of the OpenSSH client (ssh) on each system (not remote versus local). The client will request a pty from the server unless -T is given, or the RequestTTY configuration option is set to no (the latter was first available in OpenSSH 5.9). The difference in behavior arises in how the client deals with having this request denied by the server (e.g. because no-pty is given in the applicable authorized_keys entry):
Before OpenSSH 5.6:
the client will display the “PTY allocation request failed” message, and
continue in “no pty” mode
In OpenSSH 5.6-5.8:
the client will display the “PTY allocation request failed” message, and
abort the connection
In OpenSSH 5.9 (and later):
the client will display the “PTY allocation request failed” message, and
if -t was not given, and RequestTTY is auto (the default), then
continue in “no pty” mode
else (-t given, or the RequestTTY configuration option is yes or force)
abort the connection
Since your server’s ssh appears to abort when its pty allocation request is rejected, it is probably running OpenSSH 5.6-5.8 (at least for the client binary). Likewise, since your workstation’s ssh shows the warning, but continues, it is probably running an OpenSSH from before 5.6, or one that is 5.9-or-later. You can check your versions with ssh -V.
You can prevent the difference in behavior by using always giving the -T option so that the client (any version) never requests a pty from the server:
ssh -T git#YourServer
During actual Git access, the client never tries to allocate a pty because Git will give the client a specific command to run (e.g. ssh server git-upload-pack path/to/repository) instead of requesting an “interactive” session (e.g. ssh server). In other words, no-pty should not have been causing problems for actual Git access; it only affected your authentication testing (depending on which version of the OpenSSH client you were running) because the lack of a command argument causes an implicit pty allocation request (for an “interactive” session).
From the OpenSSH 5.6 release announcement:
Kill channel when pty allocation requests fail. Fixed stuck client
if the server refuses pty allocation (bz#1698)
bz#1698 seems to be a reference to a report logged in the “Portable OpenSSH” Bugzilla.
From the check-in message of OpenSSH clientloop.c rev 1.234:
improve our behaviour when TTY allocation fails: if we are in
RequestTTY=auto mode (the default), then do not treat at TTY
allocation error as fatal but rather just restore the local TTY
to cooked mode and continue. This is more graceful on devices that
never allocate TTYs.
If RequestTTY is set to "yes" or "force", then failure to allocate
a TTY is fatal.
To know why it affects only the local access, you would need to debug it like in this article.
ssh -vvv git#arrakis
If your /etc/ssh/sshd_config SSH daemon config file contains the (un-commented) line SyslogFacility AUTHPRIV, you can have a look at your SSH logs in /var/log/secure.
That being said, check out GitoliteV3: I don't think it uses no-pty in the current setup.
Beside Chris Johnsen very complete answer note that giving explicitely the info command will not show the PTY warning:
ssh git#arrakis info
In that case SSH considers that this is not an interactive session and will not request a TTY.

Tortoise SVN cannot connect to svnserve of newly created Subversion instance on SuSe Linux Server

I just started a new position where none of the code is in version control. One of my duties is to fix that. I have some space on a SuSe 10 box, and subversion 1.6 is installed. Following the instructions in the O'Reilly Subversion book, I've got a subversion repository with code in it, and svnserve running:
#lsof -i :3690
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
svnserve 15115 xxxxxx 3u IPv6 xxxxxxxx TCP *:svn (LISTEN)
Also, this command works
svnlook cat /home/svn/repos/ /project1/trunk/index.php
However, when I try to connect to the subversion repository from my desktop (running Windows) using TortoiseSVN, I get the error
Can't connect to host 'xxx.xxx.xxx.xxx': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
I have tried multiple repository URLs, including:
svn://internalmachinename.internalnetwork.com/project1
svn://machinename/project1
svn://machinename/repos/project1
svn://machinename/svn/repos/project1
svn://xxx.xxx.xxx.xxx/project1/trunk:3690
I don't have access to Cygwin because of the company's firewall policy, so I can't try to connect via the command line.
Before trying to use svn, use the simple ping command to check the connection between the two computers.
Only if that works, go to the next step (which still isn't using svn!): check if you can reach the correct port using telnet.
Then, and only then should you try to use svn to do the connection.
The firewall suggestion was close - it was the firewall on my Windows desktop that was keeping Subversion from connecting.

Resources