Uploading Source Code of Application

To upload source code of your dynamic application follow these steps.

  1. Create RSA key pair – public and private.

  2. Email the public key file id_rsa.pub as an attachment to sFTP server administrator.

  3. Once the public key is authorized by the sFTP server administrator, sftp access from the client system to the sFTP server can be made with ssh key pair authentication.

  4. Upload source code to the sFTP server.

Steps to create SSH key pair to access remote sFTP server

For Linux

To create the rsa key pair

[ Do not enter file name, use default values. Enter passphrase and keep it safe. ]

[user@localhost ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:hki5J8nD856uPZgX3feI2EKbcUGon0PgXlAxeKBlqQ user@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
| ..++*+o.        |
| .++=oooo        |
| E.+.++*.+       |
| o X =.* B o o o |
| . & o S + o     |
| . . B . . .     |
| . o . .         |
| .               |
|                 |
+----[SHA256]-----+

To list the key pair files

[ id_rsa.pub is the public key ]

[user@localhost ~]$ ls -l .ssh/
-rw-------. 1 user group 1675 Feb 15 11:33 id_rsa
-rw-r--r--. 1 user group  408 Feb 15 11:33 id_rsa.pub
-rw-r--r--. 1 user group  915 Feb 13 15:23 known_hosts

To connect to the remote sFTP server

[ Accept the authenticity of the server with yes when prompted. ]

$ sftp remoteuser@sftpserver

On successful connection:

Connected to remoteuser@sftpserver
sftp>

For Windows 10

To create the rsa key pair

[ Do not enter file name, use default values. Enter passphrase and keep it safe. ]

C:\User\UserName> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\UserName/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\UserName/.ssh/id_rsa.
Your public key has been saved in C:\Users\UserName/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:hki5J8nD856uPZgX3feI2EKbcUGon0PgXlAxeKBlqQ UserName@WinClient
The key's randomart image is:
+---[RSA 2048]----+
| ..++*+o.        |
| .++=oooo        |
| E.+.++*.+       |
| o X =.* B o o o |
| . & o S + o     |
| . . B . . .     |
| . o . .         |
| .               |
|                 |
+----[SHA256]-----+

To list the key pair files

[ id_rsa.pub is the public key ]

C:\User\UserName> dir .ssh
id_rsa
id_rsa.pub

To connect to the remote sFTP server

[ Accept the authenticity of the server with yes when prompted. ]

C:\User\UserName> sftp remoteuser@sftpserver

On successful connection:

Connected to remoteuser@sftpserver
sftp>

Important Note

  • UserName / username – local client machine user account. eg. abhik, mintu

  • remoteuser – sFTP server user account. eg. arunachal, tripura

  • sftpserver – sFTP server address

  • scadir/ – Directory to upload source code. Already available.

  • id_rsa is the private key – do not share, owner read/write permission only.

  • id_rsa.pub is the public key – share with sFTP server administrator / public.

  • Client system requirements: Linux (any flavour), Windows 10 or above.

  • For assistance contact RCoEAS, Guwahati

Basic SFTP Commands

Once you are logged in to the sFTP server successfully using the sftp user@remote.sftp.server command and see the sftp> prompt, you can issue any valid sftp commands.

Some basic sftp commands are:

  • help – view a list of available commands

  • dir – list the files in the current directory

  • ls – same as above

  • ls -l – long listing of files

  • lls – list local files

  • cd directory – change to directory

  • lcd directory – change to local directory

  • put filename – upload a local file filename to the remote sFTP server

  • rm filename – remove file filename

  • pwd – show the present working directory

  • lpwd – show the local present working directory

  • bye – exit from sFTP server

  • exit – same as above

Procedure to Upload Source Code

To upload files to the sFTP server

At the sftp> prompt change directory to scadir/ where files can be uploaded

sftp> cd scadir/

Upload the source code archive (in any format such as: tar, rar, zip, gzip etc.)

sftp> put source-code-archive.rar

To list the files

sftp> ls -l

To quit and disconnect from the sFTP server use bye or exit

sftp> bye

To directly login to the upload directory of the sFTP server use the following sftp command:

sftp user@remote.sftp.server:directory

For example:

sftp tripura@rcoeas-sftp-server:scadir

Replace rcoeas-sftp-server with appropriate IP address of the sFTP server.