Pushing a file via ftp and the bash command line to an ftp server

Since I work with the XDA server, I often have to work on stuff in the XDA server, finish it and upload it to my host. Now Goo.im conveniently offers a sftp access, that makes everything very easy. A simple scp command can transfer the file (already descibed elsewhere on my blog). However when it comes to transferring the files via simple ftp, things are a bit different. You need a bash scrip to do it.

I’ve used this script from  Ubuntuforums to suit my needs perfectly:

# The next 9 lines are lifted from mickwombat's script
#!/bin/sh
USERNAME="[email protected]"
PASSWORD="myftppassword"
SERVER="ftp.droidzone.in"
# Directory where file is located
DIR=$2
#  Filename of backup file to be transfered
FILE=$1
# login to ftp server and transfer file

curl -T $FILE -u $USERNAME:$PASSWORD $SERVER/$DIR/

This very neatly takes the file specified in the first argument, and transfers it to ftp.droidzone.in/dir where dir is the specified directory.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.
Using SSH service on Sourceforge

Using SSH service on Sourceforge

Sourceforge’s ssh service is one of the best, even though it is free. The traffic speed is great too.

Using Putty on Windows 7

Generating a Key

Download Puttygen, the key generator for Putty from here.

Run Puttygen

At the bottom section for Parameters, choose key type as “SSH2-DSA” (Not SSH2-RSA)

Click on Generate Button

When prompted, move the mouse over the blank space to “generate randomness”

Enter [email protected] for the key comment

You can now enter a passphrase. Since I dislike having to type a passphrase every time I connect to Sourceforge, I omit the passphrase.

Save private and public keys after giving them suggestive names. Do NOT close Puttygen.

Visit the Key posting page on Sourceforge

 

 

You can see a listbox where you can type in. If you have previous keys listed, you can view them there.

In the box, click anywhere on the last line, press the |END| key, and hit |RETURN|

Go back to Puttygen, after hovering the mouse over the Box titled “Public key for pasting into OpenSSH authorized keys file”, right click and choose Select All, then Copy to clipboard.

 

Go back to the box in Sourceforge account, and paste the key on a new line. Do not hit |ENTER| at the end. Click on th “Update” button.

Your key has now been added. Now we can configure Putty.

 

Configure Putty

Download Putty from here

Open Putty

Session

Hostname: shell.sourceforge.net

Port: 22

Connection type: SSH (Already selected)

 Connection

– Data

Login Details:

Autologin username: myusername,myprojectname  (Note that this is username and project seperated by a comma. Yes, the project name is to be entered as part of username in Putty)

 

SSH

Data to send to server:

Remote Command: create (Dont forget this step!)

Preferred SSH Protocol version: 1

SSH > Auth

Private key file for authentication: Choose the “private” key you saved earlier.

Go back to Session, and under Saved Sessions, type in a name for the session, like “sourceforge”, unless you want to configure your client each time.

Connection Keepalive (Optional)

While using an SSH connection over Putty, and waiting for long processes like a repo sync or a Rom compilation to be over, you may occasionally find that the session has automatically disconnected. Of course this could be due to your net connection. Occasionally it’s that the connection times out. The connection can be kept alive by the following:

Connection>Options controlling the connection>Seconds between Keepalives>20

 

Hit Open to get started, and accept the certificate if prompted.

 

Transferring files to and from Sourceforge using SFTP on Filezilla

 

Download Filezilla from here (Dynamic link to latest file)

Install Filezilla

Open the Site Manager

New Site:

Host: frs.sourceforge.net

Protocol: SFTP

Port: Leave blank

Logon type: Normal

User: username,projectname

Password: your sourceforge account password

Press Connect, trust the host key when prompted

You will be shown your site’s project directory. You can switch your default remote directory, on the advanced tab of Connection Manager

Eg: Mine is /home/users/e/er/ergomone/ergoproject

 

Important locations on Sourceforge:

User’s web space: /home/user-web/username

Project web space:  /home/frs/project/s/su/supernovakernel/ (“s/su” will change if Project name does not begin with “su”)


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.
Configuring SSH access to Sourceforge (Windows)

Configuring SSH access to Sourceforge (Windows)

Download Putty and Puttygen from here

Run Puttygen, generate an SSH key pair:

  1. Run Puttygen
  2. Click generate key
  3. Move mouse randomly over the whitespace area and wait for key generation
  4. Save your private key. You may skip the passphrase if you’re going to use the key in an automated script.
  5. Save your public key
  6. Open the Sourceforge SSH key posting page.
  7. Copy the complete public key from ssh-rsa to [email protected] to clipboard
  8. On the key posting page, go to the end of the line containing your last posted key. Hit enter, paste the copied key.
  9. Click on Update

Run Putty.exe and enter the following details:

Session

Host name: shell.sourceforge.net
Connection Type: SSH

Connection

SSH

Remote Command: create

Data

Auto-login username: user,project

Under Sessions, enter a name and Save session details
Click on Create


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.