cancel
Showing results for 
Search instead for 
Did you mean: 

ssh without password

 
Highlighted
Occasional Contributor

ssh without password

Hi,

i want to login to remote server using ssh without password. For that i tried to set "ssh-keygen" but it is still asking for password. Please find steps i performed below.

ssh-keygen -t rsa
cat .ssh/id_rsa.pub | ssh name@host_server 'cat >> .ssh/authorized_keys'

i also tried with dsa keys

from client:
ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
scp $HOME/.ssh/id_dsa.pub svm0022pdv:$HOME/.ssh/id_dsa.pub

In server:
cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
cat id_dsa.pub >> $HOME/.ssh/authorized_keys

and
i also edit file "/etc/ssh/ssh_config".

But still getting pasword prompt whenever i do ssh to server.
I am using linux machine. Can anyone help me with detailed step to solve this problem

Regards,
Kumar Nishant
4 REPLIES 4
Highlighted
Honored Contributor

Re: ssh without password

Hi,
To configure ssh with passwd

Client
Steps: For SSH Without a Password

On the client run the following commands:
$ mkdir -p $HOME/.ssh
$ chmod 0700 $HOME/.ssh
$ ssh-keygen -t dsa -f $HOME/.ssh/id_d sa -P ''

This should result in two files,
$HOME/.ssh/id_dsa (private key) & $HOME/.ssh/id_dsa.pub (public key).
Copy $HOME/.ssh/id_dsa.pub to the server.

Server:
On the server run the following commands:
$ mkdir -p $HOME/.ssh
$ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
$ chmod 0600 $HOME/.ssh/authorized_keys2

Depending on the version of OpenSSH the following commands may also be required:
$ cat id_dsa.pub >> $HOME/.ssh/authorized_keys
$ chmod 0600 $HOME/.ssh/authorized_keys

An alternative is to create a link from authorized_keys2 to authorized_keys:
$ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys

On the client test the results by ssh'ing to the server:
$ ssh -i $HOME/.ssh/id_dsa server

(Optional) Add the following $HOME/.ssh/config on the client:
Host server
IdentityFile ~/.ssh/id_dsa
This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.


Suraj
Highlighted
Honored Contributor

Re: ssh without password

> I am using linux machine.

So why ask in an HP-UX forum?

A Forum search for keywords like
ssh password
should find many old discussions on this
topic. Almost all of them will suggest using
the "-v" option in your "ssh" command. Some
of them will also suggest showing an actual
transcript of a failing command, an "ls -l"
report on your ".ssh" directory, and some
other things.

> i also edit file "/etc/ssh/ssh_config".

Uh, we can't see it, either before or after
you did whatever you did to it.
Highlighted
Honored Contributor

Re: ssh without password

Probably it's a file system permission problem. SSH is trict with permissions, check the permissions for the home directory and the .ssh directory and files, ensure that group and other don't have write permissions enabled.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Highlighted
Exalted Contributor

Re: ssh without password

Shalom,

Most of these problems come from ownership and permissions.

Take a look here for a guide.

http://www.hpux.ws/?p=10

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com