Open kgsrirama opened 4 years ago
It doesn't work. The way i would fix it is:
First generate a key pair using ssh-keygen
Get the public key (assuming it's named _idrsa.pub) from your computer (in $HOME/.ssh/ folder assuming you are on Linux), to your phone.
Copy the contents of your public key inside your phone using root browser's text editor or any other text editor of your choice.
Create a file named _authorizedkeys inside the /data/ssh/root/.ssh/ folder.
Paste the contents of your public key into the _authorizedkeys file using the text editor of your choice.
Copy that file into the /data/ssh/shell/.ssh/ folder if you want shell login too.
Now to login into your phone using ssh, you need the private key (assuming it is named _idrsa) that was generated with your public key. Type this command onto your computer in the same folder as your private key file. ssh -i id_rsa root@[_your phone's local ip_]
. You don't need to type the -i id_rsa
if you private and public key file is in your computer's $HOME/.ssh/ folder.
You got yourself a perfectly functioning key with right permissions! (Unless you didn't follow the instructions correctly)
Edit: yes the authorized_keys file should be chmod 600
In my case /data/ssh/shell/.ssh/authorized_keys need to have 600 and the owner needs to be shell user (when the owner was root it did not work). You can change both using total commander.
It doesn't work. (And unsafe too (?)) The way i would fix it is:
First generate a key pair using ssh-keygen
- Get the public key (assuming it's named _idrsa.pub) from your computer (in $HOME/.ssh/ folder assuming you are on Linux), to your phone.
- Copy the contents of your public key inside your phone using root browser's text editor or any other text editor of your choice.
- Create a file named _authorizedkeys inside the /data/ssh/root/.ssh/ folder.
- Paste the contents of your public key into the _authorizedkeys file using the text editor of your choice.
- Copy that file into the /data/ssh/shell/.ssh/ folder if you want shell login too.
- Now to login into your phone using ssh, you need the private key (assuming it is named _idrsa) that was generated with your public key. Type this command onto your computer in the same folder as your private key file.
ssh -i id_rsa root@[_your phone's local ip_]
. You don't need to type the-i id_rsa
if you private and public key file is in your computer's $HOME/.ssh/ folder.You got yourself a perfectly functioning key with right permissions! (Unless you didn't follow the instructions correctly)
THANK YOU!!!
Can someone please put this in the Readme
Though it is trivial, changing permission of authorized_keys is necessary to login to ssh A sudo chmod 600 /data/ssh/root/.ssh/authorized_keys will do the trick