Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Without changing permission of authorized_keys, ssh won't login #21

Open
kgsrirama opened this issue Aug 19, 2020 · 3 comments
Open

Without changing permission of authorized_keys, ssh won't login #21

kgsrirama opened this issue Aug 19, 2020 · 3 comments

Comments

@kgsrirama
Copy link

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

@kgsrirama kgsrirama changed the title Without changing permission ssh won't login Without changing permission of authorized_keys, ssh won't login Aug 19, 2020
@Ryuo1
Copy link

Ryuo1 commented Feb 21, 2022

It doesn't work.
The way i would fix it is:

First generate a key pair using ssh-keygen

  1. Get the public key (assuming it's named id_rsa.pub) from your computer (in $HOME/.ssh/ folder assuming you are on Linux), to your phone.

  2. Copy the contents of your public key inside your phone using root browser's text editor or any other text editor of your choice.

  3. Create a file named authorized_keys inside the /data/ssh/root/.ssh/ folder.

  4. Paste the contents of your public key into the authorized_keys file using the text editor of your choice.

  5. Copy that file into the /data/ssh/shell/.ssh/ folder if you want shell login too.

  6. Now to login into your phone using ssh, you need the private key (assuming it is named id_rsa) 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

@kbzowski
Copy link

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.

@wardbeyens
Copy link

It doesn't work. (And unsafe too (?)) The way i would fix it is:

First generate a key pair using ssh-keygen

  1. Get the public key (assuming it's named id_rsa.pub) from your computer (in $HOME/.ssh/ folder assuming you are on Linux), to your phone.
  2. Copy the contents of your public key inside your phone using root browser's text editor or any other text editor of your choice.
  3. Create a file named authorized_keys inside the /data/ssh/root/.ssh/ folder.
  4. Paste the contents of your public key into the authorized_keys file using the text editor of your choice.
  5. Copy that file into the /data/ssh/shell/.ssh/ folder if you want shell login too.
  6. Now to login into your phone using ssh, you need the private key (assuming it is named id_rsa) 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants