View previous topic :: View next topic |
Author |
Message |
Aquous l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 08 Jan 2011 Posts: 700
|
Posted: Fri Jun 22, 2012 8:44 am Post subject: [SOLVED/PEBKAC] Need some handholding setting up ssh |
|
|
Hi guys,
I need some help setting up ssh.
The idea is that I'll be able to log in to my Gentoo box from my Android tablet when something goes wrong with my computer (e.g. the display driver crashes or something like that and I want to cleanly reboot my box). I would like to use key-based authentication for this as it seems the safest and most practical option. I've managed to successfully set this up on Windows (I dual-boot Windows and Gentoo), but I can't get it to work on Gentoo. What I've done (based on http://en.gentoo-wiki.com/wiki/Public_Key_Authentication):
Code: | sudo /etc/init.d/sshd stop
ssh-keygen #(accepted all defaults and chose a passphrase, the key is stored in ~/.ssh/id_rsa)
#imported the id_rsa key into ConnectBot on my tablet
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
sudo /etc/init.d/sshd start |
On Windows (using Cygwin), this works, i.e. I can successfully log in to my computer from my tablet. On Gentoo, my tablet simply says 'authentication using public key failed'.
Can anyone help me figure this out? Do I perhaps need to add the public key to some system-wide authorized_keys file?
Last edited by Aquous on Fri Jun 22, 2012 2:30 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
gasparov Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/533891182474c1424ac98f.jpg)
Joined: 13 Apr 2006 Posts: 105
|
Posted: Fri Jun 22, 2012 1:15 pm Post subject: |
|
|
I didn't get what you did exactly, just to clear it up:
you made the rsa key on the tablet
you copied the generated pub key on the gentoo machine
you added the copied key in the authorized_keys file of the gentoo machine
As far as i remember if you want to connect from the tablet to gentoo and not viceversa you just need the rsa key of the tablet on your gentoo's authorized_keys, I don't understand where you actually launched those commands you posted. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
khayyam Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/9397496074fd0189143bb7.png)
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Fri Jun 22, 2012 1:59 pm Post subject: Re: Need some handholding setting up ssh (using pubkey auth) |
|
|
Aquous wrote: | On Windows (using Cygwin), this works, i.e. I can successfully log in to my computer from my tablet. On Gentoo, my tablet simply says 'authentication using public key failed'. |
Sounds like the permissions are not set correctly on ~/.ssh ... with Windows it'll probably be read-write-execute-exploit for all parties .. but linux will need to be go-rwx
Code: | % ssh remote.tld
% ls -ld .ssh
drwx------ 3 khayyam users 4096 Jun 22 12:30 .ssh/ |
HTH & best ...
khay |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Aquous l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 08 Jan 2011 Posts: 700
|
Posted: Fri Jun 22, 2012 2:19 pm Post subject: |
|
|
OK, guess I was doing it wrong.
I started over and did the following:
- On my tablet: Generated a 4096-bit RSA key, empty passphrase.
- Copied the generated public key to clipboard and saved it to a text file (still on my tablet).
- Saved the public key to my tablet's SD card and transferred it to my computer.
- On my computer: rm -rf'ed my ~/.ssh folder and created a new one, renamed the pubkey file to authorized_keys and put it in there
- /etc/init.d/sshd restart
When I tried to connect, it still said the authentication failed.
khayyam, my permissions on ~/.ssh are the same as yours.
The content of my ~/.ssh/authorized_keys is now: Code: | ssh-rsa [yeah, censoring this part] PC/tablet |
with no newline at the end. Is this correct?
EDIT: Never mind, I solved it. It turns out ConnectBot was trying to log in as root.
Sorry guys, looks like this was a PEBKAC issue... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|