LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-20-2013, 12:45 AM   #1
Jany
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Rep: Reputation: Disabled
perssion denied when creating private/pub key paird with ssh


Dear all,

I try to create a pair private/public keys on linux with ssh.
the command is: ssh-keygen
the system inform the following notices:
open admin_rsa: permission denied
saving the key failed:admin_rsa

but I use the root user to create the keys.

pls help me, thanks!
 
Old 02-20-2013, 01:08 AM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Try:
Code:
~# ssh-keygen -t rsa
Generating public/private rsa key pair.
.......
.......
 
Old 02-20-2013, 02:18 AM   #3
RaviTezu
Member
 
Registered: Nov 2012
Location: India
Distribution: Fedora, CentOs, RHEL
Posts: 164

Rep: Reputation: 24
Quote:
Originally Posted by Jany View Post
but I use the root user to create the keys.
You shouldn't run the ssh-keygen command as root.

If you run it as root, it probably replace the root user current keys.
 
Old 02-20-2013, 02:25 AM   #4
Jany
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
just generate the keys as the defualt filename and path, then modify the path and the filename, then it is OK.
 
Old 02-20-2013, 02:38 AM   #5
RaviTezu
Member
 
Registered: Nov 2012
Location: India
Distribution: Fedora, CentOs, RHEL
Posts: 164

Rep: Reputation: 24
Quote:
Originally Posted by Jany View Post
just generate the keys as the defualt filename and path, then modify the path and the filename, then it is OK.
I Didn't get you. What do you mean by default filename & path here?
 
Old 02-20-2013, 03:57 PM   #6
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by RaviTezu View Post
I Didn't get you. What do you mean by default filename & path here?
When you are asked to enter the filename for the key the default filename is given in brackets. If you do not enter anything but just press enter the default filename will be chosen.

I don't have experience with Redhat, but I have seen this, maybe it applies to you?
http://eosrei.net/articles/2012/01/f...n-denied-rhel6
 
Old 02-20-2013, 04:28 PM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by Jany View Post
just generate the keys as the defualt filename and path, then modify the path and the filename, then it is OK.
or...
Code:
ssh-keygen -f /home/$(whoami)/.ssh/admin_rsa -t rsa -N '' -q
as a user!
 
Old 02-20-2013, 05:20 PM   #8
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Code:
###### DIRECTIONS FOR CREATING RSA KEY################

	Directions for creating the rsa key and making the two
 servers talk to each other without password.

	1st change directory into .ssh and check what files are there.

 		[rx30@rx30 ~]$ cd .ssh
		[rx30@rx30 .ssh]$ ls -l
		total 4
		-rw-r--r-- 1 rx30 group 2980 Jun 13 12:02 known_hosts

	2nd create the rsa key.

		[rx30@rx30 .ssh]$ ssh-keygen -t rsa -b 4096
		Generating public/private rsa key pair.
		Enter file in which to save the key (/usr/rx30/.ssh/id_rsa):
		Enter passphrase (empty for no passphrase):
		Enter same passphrase again:
		Your identification has been saved in /usr/rx30/.ssh/id_rsa.
		Your public key has been saved in /usr/rx30/.ssh/id_rsa.pub.
		The key fingerprint is:
		cb:b0:40:c6:e9:f4:9e:f5:71:fc:c3:00:c0:f7:c6:75 rx30@rx30.localdomain

	3rd check that there are two new files with the following permissions

		[rx30@rx30 .ssh]$ ls -l
		total 12
		-rw------- 1 rx30 group 3243 Jun 22 15:50 id_rsa
		-rw-r--r-- 1 rx30 group  743 Jun 22 15:50 id_rsa.pub
		-rw-r--r-- 1 rx30 group 2980 Jun 13 12:02 known_hosts
	
	4th change directory back to the users $HOME

		[rx30@rx30 .ssh]$ cd

	5th copy the key to the remote server

		[rx30@rx30 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub rx30@XXX.XXX.XXX.XXX
		25
		rx30@XXX.XXX.XXX.XXX's password:
		Now try logging into the machine, with "ssh 'rx30@XXX.XXX.XXX.XXX'", and check in:

		.ssh/authorized_keys

		to make sure we haven't added extra keys that you weren't expecting.

	6th, follow directions on the screen.

		[rx30@rx30 ~]$ ssh rx30@XXX.XXX.XXX.XXX
		Last login: Fri Jun 22 14:12:08 2012 from 10.10.4.77
		[rx30@rx30 ~]$ exit
		logout
		Connection to XXX.XXX.XXX.XXX closed.
enjoy.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in copying the ssh public key (id_rsa.pub) over to the server 3abas Linux - General 1 07-15-2012 10:28 AM
what is the difference between host-based and pub-key auth in ssh? archnemesis Linux - Newbie 2 12-20-2011 06:34 PM
Unable to use pub/private keys with ssh AncientPC Linux - Newbie 18 07-28-2009 05:30 PM
Can't use private key for ssh t0ken407 Linux - Server 9 05-31-2009 02:50 PM
how to use of ftp in linux to copy ssh pub key to another host raj_hcl1986@rediffma Linux - Newbie 1 11-04-2008 04:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration