Using WinSCP to access a remote SFTP server - windows-7

I am using SFTP client(WinSCP) to get into a remote server and retrieve some files. I could not get to the SFTP server when I use WinSCP in a Windows-7 machine; but it works good when I try it from an XP machine. Can anyone think of what might be wrong. Any help appreciated!
I am also including the error screenshot, if that helps
Can anyone please help!

This could be some problem with your firewall. Check it if you are blocking WinSCP.

Quoting WinSCP documentation on the error message Server unexpectedly closed network connection:
If you get this error message while connecting to your server, it is
most usually caused by the server not being able to run some process
necessary to support your session. Always try to connect with another
SSH (SFTP) client to find, if it is server or client related problem.
Possibilities are:
Shell.
Your account may not be allowed to start a shell at all. With some servers (like OpenSSH or Sun SSH), you may need to be allowed to
start a shell, even if using SFTP protocol.
Also some servers refuse to start a shell if your password has expired or your account was terminated.
Some shells do not work with non-interactive sessions. The same it true for some configurations (or profiles used) for otherwise
working shells. This commonly exhibits with SCP protocol with
associated error message "Error skipping startup message. Your shell
is probably incompatible with the application (BASH is recommended)."
Try to force bash shell explicitly on SCP/Shell page of Advanced Site
Settings dialog. Using SFTP protocol instead of SCP is another option.
OpenSSH server may fail to start shell when chroot is configured, but not possible (e.g. due to group writeable permissions
to chroot directory).
Some environments require specific permissions (e.g. 755) to files like .profile or .bashrc.
SFTP server.
Your account may not be able to start SFTP server binary (e.g. /bin/sftp-server) or the binary is not present on your server.
Your SSH server may also lack the SFTP subsystem.
SSH server:
Your SSH server, particularly OpenSSH, may not be able to access the server key files, due to an incorrect permissions.

Related

SSH Host Key Rsync Issue

I have a bash script which uses rsync to pull down backups of my server to an offline server I have running Ubuntu.
But it does not seem my offline server wants to run this script right. And the issue I get when I run it manually run it is,
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(226) [Receiver=3.1.1]
But heres the thing, the host key is fine and works when I SSH. So logging on to my offline server and from there logging into the remote server works without any issues.
Here is where the issue gets very odd, the bash script works (when asked to run via webmin) after I have SSHed into the offline server. I dont have to do anything else, just login to the remote server and the bash script will work.
That is what I dont understand, if the host keys are not configured right, then they should not work at all, but they do, once I have logged into the server?
Thanks,
Try to login with ssh -a to prevent your ssh-agent to be forwarded. You probably use an identiy in your agent to authenticate to the target Server. This authentication will not work if your ssh-agent ist not present.

Cvs ext method "Connection refused"

I'm using Windows 7 and cygwin. I want to connect to our CVS repository with the following command:
cvs -d :ext:my_username#my_ip:/my_repo_path/ checkout my-parent
Unfortunately I'm getting this error:
my_ip:514: Connection refused
How can I provide a password so that I'm able to connect to the server?
my_ip:514: Connection refused
The cvs "ext" method connects using rsh (remote shell) by default. Port 514 is the standard rsh port. The error "Connection refused" normally means that the remote host isn't accepting connections on the requested port.
In other words, you tried to connect to the remote host using rsh, not ssh. But the remote server doesn't accept rsh sessions. This isn't very surprising, because rsh is a very insecure protocol and it's not widely used any more.
To make CVS use ssh instead of rsh, you need to set the CVS_RSH environment variable:
$ CVS_RSH=ssh; export CVS_RSH
On unix or linux, you'd normally add this line to your .bashrc, .profile, or one of your other shell startup files so that it's set automatically when you log in. On Windows, this http://superuser.com answer describes how to set environment variables. If you're on Windows, you may also need to install an ssh program, because Windows doesn't come with one.
Once cvs is set to use ssh, ssh will prompt you to type a password if it needs one.
The book Open Source Development with CVS has a section about the different cvs repository access methods, including how to set the "ext" method to use ssh.

Git SSH won't connect on custom port

I'm running on a Windows 7 machine with msysgit, git Bash, tortoisegit and posh-git all installed.
Our company has a git server that previously ran on https. Then, for a time it had both https and ssh. Now it has only ssh. Everything ran without issues on https.
I generated and installed all my keys without a problem. I can push/pull/whatever via tortoisegit with no problems. However, I can no longer use the command line in either git BASH or powershell + posh-git. I think part of the reason is because we do not use port 22, but a custom port for increased security.
Note that hostname and port number have been changed in the commands below to protect the innocent.
I get the errors below when trying to push/pull, but I'm showing commands just to test the ssh server to show that ssh is the issue (I believe). If I don't specify the port, it finds the server and attempts to connect - but since it defaults to port 22 I get an error as shown below:
C:\gitpath\design [master]> ssh ssh://git#dev.zzz.us
ssh: connect to host dev.zzz.us port 22: Bad file number
If I do specify the port, however, it then cannot find the hostname:
C:\gitpath\design [master]> ssh ssh://git#dev.zzz.us:9092/
ssh.exe": Could not resolve hostname dev.zzz.us:9092/: no address associated with name
I've looked at similar posts and they all pointed to needing the protocol included (ssh://) to prevent this error. As you can see, I'm getting this error even with the protocol in place. I've also tried with and without the ending '/' - same result. Is there something else with the syntax I'm missing?
Identifiers such as ssh://git#dev.zzz.us:9092/ can be used by git to specify
a non-standard port for SSH when configuring remote repositories. However, the
remote identifier must include the path (I prefer to use the absolute path) to
the remote repository, e.g.,
git remote add origin ssh://git#dev.zzz.us:9092/path/to/repo.git
However, to test such a connection using the ssh command, you use the -p
option to specify the TCP port number and then user#hostname:
ssh -p 9092 git#dev.zzz.us
Note: I usually use Git from a Unix system (not from Windows) and the ssh
command is provided by the Openssh package.
Edit: I just checked on a Windows box and see that MSysGit also uses Openssh
so the above commands work; I haven't checked with Powershell but there shouldn't
be any issues running the above commands through the Bash shell.

Logging into SFTP, require help chmoding pem file

I'm very, very new to Amazon EC2, SFTP -- having only used FTP clients until now. I'm trying to log into an Amazon EC2 instance and have everything I needed except a pem file with the key pair, which I have now. However I was told to chmod and reset its permissions to 400 in order to log in correctly. The problem is I have no idea how to go about doing this. There is talk of just entering chmod 400 keyfile.pem through the command line, but is that the Windows command line on my desktop? How can I do this? Any help would be much appreciated...
Either log in using an SSH client (like PuTTY).
Using it, you can execute the command you mention (chmod 400 keyfile.pem) on a command-line.
See also SSH to Amazon EC2 instance using PuTTY in Windows.
Or you can use a GUI SFTP client (like WinSCP) to set the permissions.
See https://winscp.net/eng/docs/ui_properties
Make sure only the R checkbox in Owner row is ticked (that's an equivalent of the 400 permissions in an octal format).
(I'm the author of WinSCP)

Eclipse ADT known hosts

I have trouble getting the official Windows ADT 21.1.0 distribution to connect to a git repository. No matter what I tried(details below) it complains about host key not present in the registry and shows me no option to accept the host key. The remote server is running Gitlab and is under my control. There's no problem with connectivity or firewalls.
What I tried so far:
connecting without giving a password, with user git
connecting while giving a password, with another user
adding manually the host key in the known_hosts file that is found in the ssh home directory(Preferences->General->Network Connections->SSH2->SSH2 home).
The message is always:
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 xx:xx:xx...
Connection abandoned.
RSE works without any problems, only egit gives me problems.
You could workaround the problem by not using the ssh protocol with the git server, but instead the git or http protocol.
One reason for the above message can be using a folder called "ssh" instead of ".ssh" (note the dot). Some colleague of mine experienced that, and this can easily happen when using Windows explorer, as it will silently remove the dot, when creating a folder called ".ssh". You have to use the command line instead.

Resources