Archive

Posts Tagged ‘Server’

How to transfer files between your android device and computer via wifi

Now this is what we all need when we have to transfer huge files and yet we dont have any means to use the sd card or transfer using the USB cable. Using bluetooth to transfer is pretty hectic. Wifi is much faster.

Here I use one ssh server from the android market and one client in my system. since I use ubuntu, the client is not an issue. But if you use windows machine, you can use a simple tool called scp.exe, a google search will take it to that download page.

0. connect both your computer and the android device to the same network.
1. Now as the first step, you need to install the ssh server in you android device.
2. Now specify a password. (Choose wisely as, if someone guesses this, they could get all the files from your device.)
2b. Better choose non default port as its is more secure. People will have to guess the port number also incase if they got your password.
3. Then start the ssh server.
4. Now goto your computer and open the terminal (linux) or open the scp file browser or whatever ssh client you downloaded.
5. Now if you have a GUI then you know what you have to do, just copy the files you need to the android device. (Usually copy from the left side panel to the right side panel.)
Or if you use terminal client you will have to type in some commands.
In My case the following command will copy all the mp3 files from the folder (/home/xpl0iter/.miro/Movies) to the sdcard. sdcard is the actual sdcard in the android device. You can use whatever path you need to, but for all the other path which is not sd card or the place we are not intended to copy the files, you will need root access. That means you will have to root your phone first.

scp -P 1387 /home/xpl0iter/.miro/Movies/*.mp3  192.168.2.187:/sdcard/

scp – command for copying the file using ssh. (Secure Copy)



-P 1387 – Specifying the port on which the ssh server runs in the android device.

/home/xpl0iter/.miro/Movies/*.mp3 – The files I wish to copy from the computer.

192.168.2.187 – Ip address of the android device. This will be shown on the ssh server.

/sdcard/ – the path to where I am copying the files. :)

 

How to: Make a password less SSH Login

First  you will have to generate key on local machine.

For that type in the following command in a terminal. Here we are using RSA encryption.

ssh-keygen -t rsa

It will ask you for a password but you can leave it blank.

Note you could also pick -t dsa if you prefer DSA encryption.

Ensure that the remote server has a .ssh directory

Make sure the server your connecting to has a .ssh directory in your home directory. If it doesn’t exist you can run the ssh-keygen command above, and it will create one with the correct permissions.

Copy your local public key to the remote server

If your remote server doesn’t have a file called ~/.ssh/authorized_keys2 then we can create it. If that file already exists, you need to append to it instead of overwriting it, which the command below would do:

scp ~/.ssh/id_rsa.pub remote.server.com:.ssh/authorized_keys2

Now ssh to the remote server

Now you can ssh to the remote server without entering your password.

Security

Now keep in mind that if someone need to login to the remote server, all s/he need is the file on your local machine ~/.ssh/id_rsa, so make sure it is secure.