Ssh command without password - Not working


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Ssh command without password - Not working
# 1  
Old 11-20-2014
Ssh command without password - Not working

Hi,
I have followed the below commands for key generation and ssh from one server to another with user mqm

Code:
cd /var/mqm/.ssh
mqm@A:~> ssh-keygen -t rsa
<public key creation>
mqm@A:~> ssh mqm@B mkdir -p .ssh
mqm@B's password: <entered_password>

mqm@A:~> cat /var/mqm/.ssh/id_rsa.pub | ssh mqm@B 'cat >> /var/mqm/.ssh/authorized_keys'

mqm@A:~> ssh mqm@B

But still it prompts for a password. Can anyone please help on the below.

Thanks,
Anusha M
# 2  
Old 11-20-2014
1) You create directory .ssh ( but why -p?) only what permissions has it ? shoudl be read only for the user...
2) Your cat command will also ask you tha password since the key has not been transfered yet.. and that method may not be all that safe of corruption.. the safest would have been to copy the file to add .A extension, then scp that file to server B in her .ssh directory, then update authorized_keys file
# 3  
Old 11-20-2014
It is also sensitive to the permissions of your home directory, it should not be world-readable.
# 4  
Old 11-20-2014
Quote:
Originally Posted by Corona688
It is also sensitive to the permissions of your home directory, it should not be world-readable.
Do you mean world- (or group-) writeable?

I usually have home directories world-readable and I don't recall that ever causing problems with passwordless SSH on any OS.
# 5  
Old 11-20-2014
Quote:
Originally Posted by achenle
Do you mean world- (or group-) writeable?
Yes, thank you.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

2. Red Hat

SSH password less setup asking for password

Hello Experts, when I am trying to connect my target server through sftp after creating ssh password less setup, it is asking for passowrd to connect. to setup this I followed below process: -->generated keys by executing the command "ssh-keygen -t rsa" -->this created my .ssh directory... (9 Replies)
Discussion started by: Devipriya Ch
9 Replies

3. Shell Programming and Scripting

Passing password with SSH command

Hi Experts, I have specific requirement where I want to pass the password with the ssh username@hostname command . I dont want to use RSA public and private keys also. Because that will be on production server and no one wants to give access like that. Second thing it is production... (14 Replies)
Discussion started by: sharsour
14 Replies

4. UNIX for Dummies Questions & Answers

SSH tunnel working for ssh but not for sshfs

I'm trying to setup a link between my home pc (work-machine) and a server at work (tar-machine) that is behind a gateway (hop-machine) and not directly accessible. my actions: work-machine$ ssh -L 1234:tar-machine:22 hop-machine work-machine$ ssh -p 1234 user@127.0.0.1 - shh access on... (1 Reply)
Discussion started by: Vathau
1 Replies

5. Solaris

SSH: internal working but external not working

Hi, This is a strange issue: We have an sftp server. Users can ssh to it from internal LAN without any issue, but they can not ssh to it externally via firewall. Here is what I got: OS is Solaris 9. No hosts.allow and hosts.deny files. Please help. Thank you in advance! (7 Replies)
Discussion started by: aixlover
7 Replies

6. Red Hat

ssh without password

Hi, I am trying to generate ssh without having to type a password. I have done this on numerous occasions using the procedure below and it has worked fine but not on this occasion. user1@sys1:ssh-keygen -t dsa -N "" <press enter for any questions> user1@sys1: ll .ssh/id_dsa.pub... (16 Replies)
Discussion started by: Duffs22
16 Replies

7. Shell Programming and Scripting

ssh foo.com sudo command - Prompts for sudo password as visible text. Help?

I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this: #!/bin/bash rsync /path/on/local/machine/ foo.com:path/on/remote/machine/ ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
Discussion started by: fluoborate
9 Replies

8. Shell Programming and Scripting

ssh command with password

hi: how can i use ssh with password in the command line . (4 Replies)
Discussion started by: rainboisterous
4 Replies

9. Solaris

SSH Password-less login fails on password expiry.

Hi Gurus I have a few Sol 5.9 servers and i have enabled password less authentication between them for my user ID. Often i have found that when my password has expired,the login fails. Resetting my password reenables the keys. Do i need to do something to avoid this scenario or is this... (2 Replies)
Discussion started by: Renjesh
2 Replies

10. UNIX for Dummies Questions & Answers

SSH with a --password command line???

Has anyone heard of an OpenSSH client being compiled with an additional command-line option for password input? I realize there are reasons to NOT do this, and I realize you can achieve the same type of thing with keys, but I am specifically looking to pass the username & password BOTH on the... (5 Replies)
Discussion started by: jjinno
5 Replies
Login or Register to Ask a Question