We help IT Professionals succeed at work.

When and how is  .ssh/  directory created?

akohan
akohan asked
on
Medium Priority
270 Views
Last Modified: 2013-12-06

Hello all,

I know that .ssh/ will be created when a user does ssh first time to a server but this doesn't happen under fedora?
What is the deal with .ssh/  under root  directory?

Should I create it manually or there is a way to make it up? ONCE agin this is about Fedora.

Thanks.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2007

Commented:
Are you absolutely sure it doesn't get created for root?  It does for me.

Are you sure you're looking in

/root/.ssh

Author

Commented:

Yes! I was expecting it to be created as you did but no. Yes, ran  ls  -la

it is not there.
CERTIFIED EXPERT
Top Expert 2007

Commented:
So as root, when you ssh each time to the same server it should give you the usual ssh message about the server not being known, presenting the fingerprint and asking you to confirm whether to procede.  Is that correct?

Author

Commented:

No. it seems there is a misunderstanding.

Ok. Let's say we have two machines. Machine A and B;  A is your local server and B is a new freshly installed machine.
1) I run  "ssh-keygen -t rsa "  command under /root/.ssh
2) it creates a rsa_key.pub file
3) id_rsa.pub is generated under /root/.ssh/
3) since I need to make a trusted hosts connection I will scp the file in step 3 onto machine B :
   # scp /root/.ssh/id_rsa.pub   root@IP_OF_Machine_B:/root/.ssh

Problem: .ssh/ doesn't exist under /root

How can I create it on Machine B? except manual method? there must be a solid and systematic way to have B create it.

Any comment?

Thanks

Top Expert 2005
Commented:
> How can I create it on Machine B? except manual method? there must be a solid and systematic way to have B create it.
No, there's not. Some distributions put this directory into user's skeleton - but not all (/etc/skel)
ssh - while using will creast this dir for saving known_hosts (same applies to ssh-keygen)
Otherwise, create by hand, but follows rules
mkdir $HOME/.ssh && chmod 0700 $HOME/.ssh

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Top Expert 2007
Commented:
Step 3 is the easiest most systematic way of doing it.

Author

Commented:


I found that this could happen on some distriubtion that OS makes the .ssh/ directory but mostly root has to make it.

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.