LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't find .ssh dir in home dir (http://www.linuxquestions.org/questions/linux-newbie-8/cant-find-ssh-dir-in-home-dir-710095/)

bobby953 03-08-2009 04:30 PM

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.

Tinkster 03-08-2009 04:55 PM

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

bobby953 03-08-2009 11:19 PM

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!

bobby953 03-08-2009 11:23 PM

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?

Tinkster 03-09-2009 02:59 AM

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

bobby953 03-09-2009 04:00 AM

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 :)


All times are GMT -5. The time now is 03:55 AM.