Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Apr 15, 2012 7:43 pm 
Offline
Junior Member

Joined: Sun Apr 15, 2012 7:31 pm
Posts: 25
Gidday guys

Total Linux newb. I've been setting up my Linode, and got stuck at the key authentication part.

I'm using Putty, PuttyGen, and Ubuntu 10

I was successfully able to create the public and private keys, and save them on my local pc. I then put the public key in the file at /etc/ssh/authorized_keys in my root (all on one line).

When connecting I get a 'server refused our key' error.

the docs mentiona .ssh dir. Do I include the dot as in
/etc/.ssh/authorized_keys, or should it be /etc/ssh/authorized_keys ? I tried it with a dot, but there is a save error when I try to finish writing the file.

Also, should it start with /etc or should there be a user name in there?

I've stopped Pageant (to eliminate any problems with that and Putty communicating), and tried loading the .ppk file directly into Putty using the 'Private key file for authentication' browse box.

Also, when I type chmod go-w $HOME $HOME/.ssh $HOME/.ssh/authorized_keys (as in the instructions at 8.3 Getting ready for public key authentication), I am told there is no such directory. The manual isn't clear about exactly where the .ssh dir is (I have been saving in the ssh dir, not .ssh). Is it in /etc ?

Also, while setting this up, should I be logged in as root or as the 2nd user?

Everything else seems fine - I think there is only something small stopping this working.

Thanks for your help guys!!!

BTW - the Linode support has been fantastic. I peppered them with questions last night during set up, and they responded fast and have been helpful. This morning they suggested I place this type of question here in the forum.

Cheers

Shaun


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 7:50 pm 
Offline
Senior Member

Joined: Wed Jun 08, 2011 11:25 pm
Posts: 51
I assume you're reading Linode's guide? The .ssh directory goes in the home directory of the user you want to log in as, not in /etc. The short way of notating that would be ~/.ssh (~ being short for the home directory)


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 8:59 pm 
Offline
Junior Member

Joined: Sun Apr 15, 2012 7:31 pm
Posts: 25
Thanks for that.

So I tried...

- logging in as root
- typing nano /.ssh/authorized_keys
...to create the file, and then copied the key into it, and save out

I get the error:
Error writing /root/.ssh/authorized_keys: No such file or directory ]

instead tried
- typing nano ~/.ssh/authorized_keys

but get the same error

There is something fundamental I'm not understanding about how to use ~, and if it should be ssh or .shh

Can someone please elaborate a little - cheers?

Just as a note - I'm not using Linux locally, just windpws, so I am following...
'generate the SSH keys by following the instructions in our PuTTY guide.'


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 9:10 pm 
Offline
Senior Member
User avatar

Joined: Sat Feb 25, 2012 4:44 pm
Posts: 71
Website: http://inhomeitsupport.com
Can you run this command where your're authorized key file is?

ls -l the authorized key file should only have rw for owner.


-rw------- 1 mike mike 2611 Apr 9 20:15 authorized_keys2

this is where I would start. it will not work unless the permissions are like this.


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 9:14 pm 
Offline
Junior Member

Joined: Sun Apr 15, 2012 7:31 pm
Posts: 25
Hi kyrunner

That's the thing though - I can't save an authorized_key file - I get the errors mentioned above.

I would be brilliant if someone could type out what I write to create a new authorized_key file, and where I type that ie do I log in as root or as the 2nd user I created in one of the previous setup steps.

Thanks for your time and help.

btw typing ls -l gives me 'total 0'


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 9:27 pm 
Offline
Senior Member
User avatar

Joined: Sat Feb 25, 2012 4:44 pm
Posts: 71
Website: http://inhomeitsupport.com
1, cd .ssh

2, cat > authorized_key (then hit enter) (Then hit control D)

3, ls -l

4, report back with the ls -l command


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 9:32 pm 
Offline
Junior Member

Joined: Sun Apr 15, 2012 7:31 pm
Posts: 25
cd .ssh gives me 'no such file or directory'

Should I be logged in as root?

When I type ls / from where I am, this is the listing...

bin cdrom etc lib media opt root selinux sys usr
boot dev home lost+found mnt proc sbin srv tmp var


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 9:34 pm 
Offline
Junior Member

Joined: Sun Apr 15, 2012 7:31 pm
Posts: 25
Thanks BTW!


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 9:38 pm 
Offline
Senior Member
User avatar

Joined: Sat Feb 25, 2012 4:44 pm
Posts: 71
Website: http://inhomeitsupport.com
No don't log in as root do all these commands as the user you want to set up ssh keys.. also don't do sudo or su just log in as the user not root and run the commands..

1, mkdir .ssh

2, cd .ssh

3, cat > authorized_keys (hit enter) (then control D)

4, ls -l

5, report back with the ls -l command


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 9:57 pm 
Offline
Junior Member

Joined: Sun Apr 15, 2012 7:31 pm
Posts: 25
OK

It says

-rw-r--r-- 1 then my user name twice plus time info etc then authorized_keys


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 10:01 pm 
Offline
Senior Member
User avatar

Joined: Sat Feb 25, 2012 4:44 pm
Posts: 71
Website: http://inhomeitsupport.com
1, chmod og-r authorized_keys

2, ls -l

3, report back ls -l


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 10:11 pm 
Offline
Junior Member

Joined: Sun Apr 15, 2012 7:31 pm
Posts: 25
all the same except it's now...

-rw-------


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 10:19 pm 
Offline
Senior Member
User avatar

Joined: Sat Feb 25, 2012 4:44 pm
Posts: 71
Website: http://inhomeitsupport.com
Perfect!!

1, have you have created you're public key using putty gen.. if so move on two step 2

2, copy and past your're public key into your authorized_key file

3, log into your server with the username you created the authorized_key file.

4, cd .ssh

5, vi authorized_keys

6, paste from step two into the authorized_key file

7, shiftzz

that should be it


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 10:44 pm 
Offline
Junior Member

Joined: Sun Apr 15, 2012 7:31 pm
Posts: 25
THANKS SO MUCH Kyrunner!!! That info wasn't in the guide, so you've helped me out a tonne. I spent 6 hours trying to figure it out last night!!!!


Top
   
 Post subject:
PostPosted: Sun Apr 15, 2012 10:50 pm 
Offline
Senior Member
User avatar

Joined: Sat Feb 25, 2012 4:44 pm
Posts: 71
Website: http://inhomeitsupport.com
Great so its working?


The Linode Guide is really bad it needs rewritten from scratch.

I'm glad I was able to help. if you ever need any more linux help.. I have a Linux help forum.. its in my signature.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


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

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group