I'm having trouble using SCP to upload files to Sourceforge - shell

So I finished writing my first program and I'm trying to upload it to my sourceforge account, but the file size is to big to use the normal html5 upload manager sourceforge provides. Soursceforge says "For larger files, use FTP, SCP, or rsync". They also provided this page for references of what to commands to send via the command line like this one, which I had no idea how to use
scp file.zip jsmith#frs.sourceforge.net:/home/frs/project/fooproject/Rel_1
Should I be able to run this through the WinSCP.com prompt like so?
WinSCP> scp file.zip jsmith#frs.sourceforge.net:/home/frs/project/fooproject/Rel_1
Seeing as how the commandline kicked my but (I'm totally open to learning how to use the commandline for file transfer to sourceforge if you have any links to any tutorials, this one was too difficult to understand with all the broken English :/ ), I tried creating a connection with the WinSCP GUI and the following info
Host: myusername#frs.sourceforge.net
Username: MyUsername
Password: MyPassword
but I get the following error before the SCP connection is finished
Connection has been unexpectedly closed. Server sent command exist
status 1.
Error skipping startup message. Your shell is probably incompatible
with the application (bash is recommended).
Any help or a nudge in the right direction would be greatly appreciated. From what I've gathered I should learn more about shells, but I have no idea where to begin. Thanks in advance and cheers!

You are using SCP protocol with WinSCP. Make sure you use SFTP.

It appears that you're trying to do something weird with WinSCP. You're trying the "Open Terminal" option, which, I think just tries to open an ssh session at the host. But, we don't support ssh sessions to the frs.sourceforge.net
Normally, if you try to ssh to that host, you get this message:
Welcome!
This is a restricted Shell Account.
You can only copy files to/from here.
Connection to frs.sourceforge.net closed.
But I think WinSCP eats that, or something.
Anyway, I think what you need to do is just use WinSCP as a graphical two-pane sftp client. Navigate to the file to upload on the left, and to the destination directory on the right, etc.

In general, the best place to ask this kind of question is one of the three following:
The sourceforge channel on irc.freenode.net
Email support at sfnet_ops#geek.net
Open a ticket at https://sourceforge.net/p/forge/site-support/new/
While we do sort of monitor Stackoverflow, it's not our fastest support channel. I've asked one of our support engineers to take a look.

Here is how to connect:
select protocol SCP
Click Advanced
Environment --> SCP/Shell --> Shell (see 3 in red): change the shell that is available on the target server
It can connect to Windows 10's ssh server, with git bash

Related

Shell script to download files from SFTP

I am working on building a application that will pull data from SFTP.
Basically I have written a shell script that's run on a cron job daily.
Now I want to know if I can implement some logic in the shell script that will scan the files (for security threats – such as: software viruses, worms, Trojans, adware, etc.) before downloading. Is that possible and how?
You basically want to "remote control" your SFTP session. There are several ways to do this, but I don't see, how you can scan a file for a virus using the (S)FTP protocol, without downloading it. This would require to execute a program on the remote side, and for what I know, FTP does not support this.
Maybe ssh would be the tool of choice. First open a ssh session, do all the checking of the files, then transfer them with FTP. If you are really paranoid, you can calculate the MD5 sum of the file before the checking, and after the download, and verify that they are identical.

How would I create an SFTP connection if my application framework does not contain an API for it?

I am trying to connect to an SFTP server with my AIR application. It doesn't matter that it's an AIR application except that I haven't found any libraries or AIR API methods for it.
My first thought is to find a library in another language and rewrite it in ActionScript. I'd rather not do that and my lack of experience may introduce security issues.
My second thought is to call a native process or command such as sftp or sshpass or curl from my main application and pass the local and remote upload locations to it and let it do the work. The downside to this is if they don't have the command installed they have to install a separate program.
My questions are:
Are these SFTP commands available by default on both Mac and Windows?
Should I store the users login (I do not want to) or prompt them to enter it each time? Does SFTP / public key remove the need for that?
I've found two related questions here and here but some of it is over my head. They also seem to be specific to *nux (which may work for Mac as well but not Windows).
I do not have the experience in this area so I would welcome those with experience to give guidance if this is a good idea or not. Overview type answers are welcome for me as I can attempt to work out the details. If no answer is given, once I've figured it out I'll post an answer. Please do not close this question (rather suggest edits).
FYI I'm using AIR to make a native process call.
An AIR application in the extended desktop profile can execute a file,
as if it were invoked by the command line. It can communicate with the
standard streams of the native process. Standard streams include the
standard input stream (stdin), the output stream (stdout), the
standard error stream (stderr).
I can also create and call a scpt, sh or bat file.
Commands installed on my Mac:
curl_init(), curl_setopt()
ssh
sftp
Commands not installed on my Mac:
sshpass
Are these SFTP commands available by default on both Mac and Windows?
No. There is no sftp nor ssh on windows by default, unless you install it through cygwin or bundle them in your application (also solution).
Should I store the users login (I do not want to) or prompt them to enter it each time?
Prompt is preferred.
Does SFTP / public key remove the need for that?
Yes, but you will have to store private key, which is almost the same like storing password.

how to copy files from solaris to windows

Guys this is my first solaris script. I am really sorry if the question is obvious.
Thanks for your answers. We have a Solaris server in which I want to backup the database and then I want to copy the back up to windows back up server.I am planning to write a Solaris bash script and schedule it to run weekly.At first I was thinking of developing a windows batch file but there are several Linux/Solaris commands that I want to be executed and batch file didn't work well, that's why I decided to do it as a Solaris bash script. On Solaris side I created a script for creating the back up, now my problem is to write a script in which I can copy the back up from Solaris to windows back up server over the network.
Thanks
It is not clear from your question if you need to write a script that can do the transfer of files in an automated way ... or if this is an ad-hoc requirement. Anyway I'll go with the latter just like the other answers you've got so far.
For anything related to working with Linux/Unix hosts from a Windows box you'll enjoy MobaXterm. It's an all-in-one handy tool that wraps all the other tools that you would otherwise have to install (terminal emulator, scp, ftp, X server, etc). I can only recommend it. There's a free version. (no, I'm not affiliated with MobaXterm in any way).
Here's a picture where I've logged into a Solaris box.
The right-hand side is essentially an embedded Putty. The left hand-side allows you to upload/download files to/from your remote host, in this case a Solaris host. You would press the buttons I've circled.
MobaXterm has tons of other features packed in a footprint of only 15 Mb.
Easiest option:
Start Command Prompt on Windows box, type;
ftp <solaris-ip>
username password
bi
get <file>
quit
Second easiest option:
Install FileZilla FTP server on Windows
Sit at Solaris box & start xterm
ftp <windows-ip>
username password
bi
put <filename>
quit

MobaXterm drag-and-drop panel missing

I need to run a program from my windows xP machine thats installed on a remote UNIX machine using MobaXterm but I have very little experience with this sort of thing.
I can login into the machine using ssh and start the program without a problem. That program needs files that I have on my windows computer to process though and I want to copy them over to that remote machine. Unfortunately the drag-and-drop file transfer panel that is mentioned regularly on mobaxterm help sites isn't present and I can't figure out how to make it appear.
Could someone suggest how to get that drag-and-drop panel to appear please? I'm using MobaXterm version 3.0.
Alternatively any explanation on how to transfer these files another way would also be very much appreciated.
Thank you very much for any help you can give.
If it still doesn't work when you try all of above methods, try this:
when you creat a Session, change the Advanced SSH setting-->SSH-browser type to SCP, which default is SFTP.
. thanks to willfurnass
Some Linux distributions or some other Unix systems have disabled SSH password authentication by default.
In order for MobaXterm to be able to launch the SFTP browser, you will have to re-enable this feature:
Edit the "/etc/ssh/sshd_config" file on your server, and comment the following line:
PasswordAuthentication no
Restart your SSH server using the following command: /etc/init.d/sshd restart
Connect using MobaXterm SSH client and you will notice that the SFTP tab will be correctly launched.
If you can not modify your remote server configuration, you can also perform your file transfers inside MobaXterm terminal using SCP. A sample SCP command would be:
scp -r /drives/c/Some/Place/On/Your/Local/Windows/Drive/ yourlogin#yourserver:/Some/Place/On/Your/Remote/Unix/Server/
Ensure you have "Display SFTP Browser" enabled in your session settings under "Advanced SSH settings".
Occasionally it doesn't reappear, which is solved by a restart MobaXterm.
Another cause for the lack of sftp panel is if you accidentally enter and store a bad sftp password. MobaXterm then appears to attempt an automatic log in, but silently fails to open the sftp connection.
To fix this, go to Settings>MobaXterm passwords management and delete the offending password. Here's a screenshot of the settings page, showing the password management link.
To be clear, I had already run through the settings mentioned by #Nicolas and #Didier (thanks, guys!). I was able to get the sftp tab when ssh'ing in to other hosts (which didn't have bad passwords stored). And I had in the past seen the sftp pane. This fix solved my problem.
If you've never seen the sftp pane, then try the other suggestions first.
Have you tried:
Turning the program off and on again?
Note: I read this hint in a comment, which saved me from a tidious process of unnecessary fixing mobaXterm, also I am hence not the only one with that behavior. Even though this might be the first thing you already tried, some might not have been trying and haven't been lucky enough to read through the comments - this is for them.
For the most recent versions, ensure you have selected 'SFTP protocol' in the'SSH-browser' selector:

How can I keep an ssh connection open on windows and use it with perl?

I am trying to work on a old script of mine that I was writing to backup file on my VMware server.
Originally the script was going to run on Linux only, but now I trying to figure out how to make it run on Windows. Most of the modules I need for perl will run on Windows and Linux which is good. But there is one module that I can't seem to find, which is an SSH module.
My plan was to use putty or plink to send commands to the server and return them to the script. But the problem that I see is every time I call putty in the script its going to open new connection to server and close it when it has finished. What I am looking for is a way to open a connection once its open leave it open and then send and receive from that one connection. Only having it close when the script calls a close function or something.
Any idea where I could being with something like this?
Unless someone else has a much better idea because I am open to anything.
There's quite a few SSH client modules from CPAN, such as Net::SSH, Net::SSH::Perl, and Net::SSH2.
You can also try using Expect
http://metacpan.org/pod/Expect

Resources