View Full Version : [ubuntu] Where to put my SSH keys?
pstein
January 13th, 2010, 05:06 PM
I have generated SSH *.pub and *.ppk keys.
Where should I put them so that they are automatically used and available when e.g. issuing an
ssh ....
command in Terminal?
Peter
cdenley
January 13th, 2010, 06:06 PM
Are you connecting from putty to ubuntu? If so, public keys which can authenticate are stored in ~/.ssh/authorized_keys, one per line.
cariboo
January 13th, 2010, 06:51 PM
If you follow this howto (https://help.ubuntu.com/community/SSH/OpenSSH/Keys), the keys are automagically put in the correct place.
cdenley
January 13th, 2010, 06:55 PM
If you follow this howto (https://help.ubuntu.com/community/SSH/OpenSSH/Keys), the keys are automagically put in the correct place.
Except they seem to be using a putty client, since they have a thier private key in a .ppk file.
bodhi.zazen
January 13th, 2010, 09:34 PM
Except they seem to be using a putty client, since they have a thier private key in a .ppk file.
Server side it is the same, putty or no, the .pub key goes in ~/.ssh/authorized keys (or alternate location if you change).
client side, it does not matter , you can keep the keys anywhere you wish with putty and store your preferences. With ssh you have to specify the key or add it to RAM with ssh-add.
pstein
January 14th, 2010, 04:44 PM
Are you connecting from putty to ubuntu? If so, public keys which can authenticate are stored in ~/.ssh/authorized_keys, one per line.
I want to connect from Ubuntu to a remote Solaris machine.
Folder ~/.ssh exists but not /authorized_keys
The keys are already generated. Do I have to create manually the subdir /authorized_keys and put the keys into?
Again: I don't want to connect from another remote machine to local Ubuntu but the other way round: I want to connect through SSH comand line command to remote machine. E.g. for setting up a SSH tunnel
Peter
cdenley
January 14th, 2010, 04:47 PM
I want to connect from Ubuntu to a remote Solaris machine.
Folder ~/.ssh exists but not /authorized_keys
The keys are already generated. Do I have to create manually the subdir /authorized_keys and put the keys into?
Again: I don't want to connect from another remote machine to local Ubuntu but the other way round: I want to connect through SSH comand line command to remote machine. E.g. for setting up a SSH tunnel
Peter
Openssh in ubuntu does not use putty's private key format. Generate new keys with ubuntu as described in the howto linked to previously.
authorized_keys is a FILE on the SERVER which tells sshd which public keys are allowed to connect. You need to add the public key generated in ubuntu to the authorized_keys file in your user's home directory (~/.ssh/authorized_keys) on the Solaris server you are connecting to. The private and public key generated in ubuntu should then be placed in your ~/.ssh directory in ubuntu.
bodhi.zazen
January 14th, 2010, 05:00 PM
Generate the keys on the CLIENT (ubuntu)
On the SERVER ~/.ssh is a DIRECTORY and ~/.ssh/authorized keys is a file containing a list of public keys, one per line, allowed to access the server.
On the CLIENT (Ubuntu) use the command
ssh-copy-id -i ~/.ssh/key_name user@server
http://linux.die.net/man/1/ssh-copy-id
pstein
January 14th, 2010, 06:32 PM
Generate the keys on the CLIENT (ubuntu)
On the SERVER ~/.ssh is a DIRECTORY and ~/.ssh/authorized keys is a file containing a list of public keys, one per line, allowed to access the server.
On the CLIENT (Ubuntu) use the command
ssh-copy-id -i ~/.ssh/key_name user@server
http://linux.die.net/man/1/ssh-copy-id
Ok, thank you.
From what have read "ssh-copy-id" is used to copy my pub ssh key to the remote server. Is the command usable if the remote OS is NOT Linux/Ubuntu but Solaris?
Do I have to put both - my private and my public OpenSSH key into my ~/.ssh folder?
Peter
bodhi.zazen
January 14th, 2010, 07:25 PM
Ok, thank you.
From what have read "ssh-copy-id" is used to copy my pub ssh key to the remote server. Is the command usable if the remote OS is NOT Linux/Ubuntu but Solaris?
I would assume so, but I do not run a Solaris server, but you can answer the question for us very fast by giving it a try ;)
Do I have to put both - my private and my public OpenSSH key into my ~/.ssh folder?
Peter
You may keep these files wherever you wish. The default location is ~/.ssh
As has been explained several times on this thread, the .pub key goes to the server, into ~/.ssh/authorized_keys, one key per line. Once the file is on the server you do not need it on the client, you can delete it if you wish.
You can change the location on the Server by editing /etc/ssh/sshd_config on the server.
You can change the location of the key on the client to wherever you wish, you simply specify the location in the command.
ssh -i ~/.ssh/key user@server
or, if you prefer
ssh -i /full/path/to/some/alternate/location/wherever/you/like/your/key user@server
Powered by vBulletin® Version 4.2.2 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.