LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 01: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, 02: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, 03: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, 03: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, 03: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, 04:57 PM   #6
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 808

Rep: Reputation: 216Reputation: 216Reputation: 216
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, 05:28 PM   #7
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,159
Blog Entries: 10

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
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, 06:20 PM   #8
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
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 11:28 AM
what is the difference between host-based and pub-key auth in ssh? archnemesis Linux - Newbie 2 12-20-2011 07:34 PM
Unable to use pub/private keys with ssh AncientPC Linux - Newbie 18 07-28-2009 06:30 PM
Can't use private key for ssh t0ken407 Linux - Server 9 05-31-2009 03: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 05:24 PM


All times are GMT -5. The time now is 08:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration