Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In OSX (Linux), how do I get to the SSH keys with my root directory?

share|improve this question

migrated from stackoverflow.com Feb 20 '11 at 3:25

This question came from our site for professional and enthusiast programmers.

2  
Do SSH keys have something to do with directories? –  Matti Virkkunen Feb 20 '11 at 3:09
    
"OSX (Linux)" ... ok... now can you say something to make me think that you aren't a bot and should be trusted with ssh keys? Also, what Matti said. –  TomMD Feb 20 '11 at 3:14
2  
"I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." -- Charles Babbage –  Simon Feb 20 '11 at 3:25

3 Answers 3

up vote 1 down vote accepted

Not entirely sure what you are asking....

But for Linux ssh files (public rsa, authorized keys, etc) are stored in ~/.ssh

So for root they would be /root/.ssh/

Not sure if this is the same for OSX though.

share|improve this answer

In OSX, SSH keys are stored in ~/.ssh/id_dsa and ~/.ssh/id_rsa, where ~ is the home folder of the user. Normal users' home folders are generally stored in /Users/, but root's home folder (on OSX; not on Linux) is /var/root. To get to these from your root directory (i.e. /) simply use the cd command as you normally would, although bear in mind that only root is likely to have access to /var/root. Alternatively, you can access hidden folders (those whose names begin with a '.' from the Finder by selecting "Go to Folder..." from the "Go" menu and typing the desired path into the input box that comes up.

Bear in mind that you will need to activate the root user before you can log in using it on the client version of OSX. Be certain you know what you're doing and understand the risks before you enable the root user, especially if you're going to do so on a computer that arbitrary machines will be able to SSH into.

share|improve this answer

In OSX all ssh keys are generally stored under the user/.ssh directory Of course - you can move them anywhere if needed (may be needed for access to EC2 due to permissions)

Chances are since you are asking - YOU MAY NOT HAVE AN SSH KEY GENERATED YET...

So -let's start there first:

From the terminal window simply run: ssh-keygen -d and you can then follow the prompts -

Once complete if you were to browse to your terminal and then once it is opened simply type

cd .ssh

you should be able to view your ssh keys

If you wish to copy the SSH key to another linux/nix based system simply use scp

scp ~/.ssh/id_dsa.pub (or whatever name you gave it) www.servernameorIPaddress.com:/root/.ssh/authorized_keys2

I would suggest always using the -d option when doing the keyGen simply because RSA keys are generally not used in Version 2 of SSH.

I hope that helps - if not feel free to ask for clarification and I will help you along.

---- one last note ----

If you are looking to use ROOT on your system - this link may help you a little bit: http://snowleopardtips.net/tips/enable-root-account-in-snow-leopard.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.