View Single Post
Posts: 207 | Thanked: 119 times | Joined on Nov 2009 @ Pittsburgh, PA, USA
#10
Step by step protocol for create passwordless connection:
1. install packages OpenSSH (client, if you want server too) and rootsh on n900.
2. open x-term
3. "sudo gainroot" (or just "root")
4. "ssh-keygen -t rsa" (create keys)
Use everything by default (press enter)
5. $ "cd .ssh" (go to folder .ssh)
6."cp id_rsa.pub N900_id_rsa.pub". it make copy key file to N900_id_rsa.pub. You can use any name. It is helpful if you have many servers.
7. "scp N900_id_rsa.pub ServerUserName@IPofServer:/PathToUserHomeOnServer/.ssh/" If you are going to connect like root it will be:
"scp N900_id_rsa.pub root@IPofServer:/root/.ssh/". you will be asked for password. it will copy your password file on server
8. "ssh ServerUserName@IPofServer". Connect on server. You will be in home folder of User
9. "cd .ssh" Go to folder .ssh. For root it will be /root/.ssh
10. "ls" Get list of files in folder. You should look for "authorized_keys" or "authorized_keys2" file. I don't know why but some servers have "authorized_keys2" file by default. It is not necessary to exist.
11. "cat N900_id_rsa.pub >> authorized_keys". this will attach text from N900_id_rsa.pub file to the end of authorized_keys. If in previous step you find file "authorized_keys2" you should use "cat N900_id_rsa.pub >> authorized_keys2".
12. "exit". Disconnect
13. "ssh ServerUserName@IPofServer" You should connect to server without password. If you asked for password that mean something wrong here.
Create script:
1. Open any text redactor which can save text "ascii" files. on n900 it could be "leafpad" (starting from menu) or "nano" and "vi"(for x-term). You should install packages before. I personally more prefer nano. But you can use windows Notepad.
2. put first line "#!/bin/sh"
3. Add all commands which you type in terminal when connected to server.
4. Save file like "ascii" for example it will have name: "commandsFile"
5. open x-terminal
6. "scp commandsFile ServerUserName@IPofServer:/usernameHomeFolder/" for root it will be "scp commandsFile root@IPofServer:/root/". this will copy you file to server. Should be without Password (if you copy from device which you used in "protocol for create passwordless connection")!!! If you use other user than root probably will be better to store this file in "/usr/bin" but it is on your choice....
7. "ssh UserName@IPofServer chmod ug+x /usernameHomeFolder/commandsFile" Make this file executable.

For running this script you should use:
"ssh UserName@IPofServer /PathToFile/commandsFile"
P.S. how to find new information for n900 you can google it! in this case: "passwordless login linux". In most of cases it will work for n900 except missing some packages. If you will need porting some packages from other distribution (like debian) you can make request for porting here, on forum. Most of packages (for command line execution) can be easily ported.
 

The Following User Says Thank You to mikhmv For This Useful Post: