LinuxQuestions.org
Review your favorite Linux distribution.
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 03-08-2009, 04:30 PM   #1
bobby953
Member
 
Registered: Mar 2009
Posts: 41

Rep: Reputation: 15
Can't find .ssh dir in home dir


Hi all
I've been running a very fine Centos Server with samba and ssh. I have password based authentication for ssh.
I was trying key based authentication. I know how to do it but

I can't find .ssh dir in my home dir. I know it's a hidden dir, but it's just not there. ls -la doesn't show it. It's not there even in root's home. Plz note that I can ssh into my server using password, so that means my sshd is properly configured and working.

Am i doing nuts or ~/.ssh simply doesn't exist? Do i simply make one myself?

Thanks guys in advance.
 
Old 03-08-2009, 04:55 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Hi,

And welcome to LQ!

Yes, if the .ssh dir doesn't exist you should be able to just create
it and go with that. Make sure the perms are sane (0700) and create
your id_dsa there. It's normal to be able to connect using id/passwd
if the dir doesn't exist.



Cheers,
Tink
 
Old 03-08-2009, 11:19 PM   #3
bobby953
Member
 
Registered: Mar 2009
Posts: 41

Original Poster
Rep: Reputation: 15
Thanks Tink for your prompt reply. So I went ahead and created the .ssh folder in my home dir on my centos server.

I'm trying to set up password less authentication, so i can run a backup script from cygwin on win pc thru ssh tunnel.

On my windows pc (in cygwin), i created rsa key pairs. i copied my public key to my server and put that key in ~/.ssh/authorized_keys
Restarted the sshd daemon. It should work right. But it's not

Also note that I do have the server's public key in my ~/.ssh/known_hosts on my windows pc.

when i try to ssh into the server, it is still asking for password. what am i doing wrong?

Thanks in advance!
 
Old 03-08-2009, 11:23 PM   #4
bobby953
Member
 
Registered: Mar 2009
Posts: 41

Original Poster
Rep: Reputation: 15
Also note that in my sshd_config the following are commented out

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedkeysFile .ssh/authorized_keys

So they are allowed by default. So why isn't this setup working?
 
Old 03-09-2009, 02:59 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Have a look at the logs at the remote end, or invoke the ssh connection on
the local side with -v (vv or vvv) to see what it's doing/trying to do...

You may want to try dsa instead of the rsa, also.


Cheers,
Tink
 
Old 03-09-2009, 04:00 AM   #6
bobby953
Member
 
Registered: Mar 2009
Posts: 41

Original Poster
Rep: Reputation: 15
Hi Tink

Thanks for pointing me towards the logs in /var/logs/secure. I saw an entry saying "Authentication refused: bad ownership or modes for directory"
I just had to fix the permissions for .ssh dir and the authorized_keys file as follows:

chmod 700 for my home directory (it was already 700 be default, which is good)
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Everything is working fine and i can connect to my box via key based authentication. Thanks for all your help
 
  


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
Removing a Specific Dir From All /home Dir carlosinfl Linux - General 4 06-09-2008 01:08 PM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 02:57 PM
Share configuratin dir (.dir) for 3 accounts on local computer LiNuXkOlOnIe Linux - Software 5 01-08-2006 03:36 AM
find users home dir c++ Simon_6162 Programming 2 02-04-2005 07:53 PM
howto make a dir shared that is not in my home dir Schmurff Linux - Newbie 2 06-19-2004 07:54 PM


All times are GMT -5. The time now is 10:58 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration