I am trying to implement SSH between two systems say ukblx151 & ukapx047 with ID say khzs228, i follow the following process:
Step-1) $ ssh-keygen -t rsa -f rsa
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in rsa.
Your public key has been saved in rsa.pub.
The key fingerprint is:
5c:cb:fb:ec:87:a2:0e:92:a4:bd:e7:8f:99:1b:5c:50 khzs228@ukblx151
Step-2) $ cat rsa.pub | ssh khzs228@ukapx047 `cat - >> /home/khzs228/.ssh/authorized_keys`
Pseudo-terminal will not be allocated because stdin is not a terminal.
khzs228@ukapx047's password:
stty: tcgetattr: A specified file does not support the ioctl system call.
I get the above error (i.e. stty:tcgetattr: A specified file does not support the ioctl system call.), can anybody help?
The "cat ssh.pub | ssh" part means that ssh got a pipe as stdin which is not a terminal. Hence it did not allocate a pseudo-terminal, as it's not a terminal tcgetattr() is not going to work.
I just tried one thing, i used "'" instead of "`" in cat rsa.pub | ssh khzs228@ukapx047 `cat - >> /home/khzs228/.ssh/authorized_keys` command & i am very happy to tell you that it worked & the problem of stty: tcgetattr didnt appear, but issue here is when i give a command like "ssh user@destination-server.com" it again asks for user's password, & this i dont want, it shouldnt ask for password. Any ideas?
Only the user on the source (local) system need to generate a key-pair. When generating this key-pair, a blank passphrase should be entered.
The key has to be added to the file that is specified in your sshd_config file (this would be usually the authorized_keys or authorized_keys2 file in the $HOME/.ssh directory)
Your $HOME/.ssh/<private_key> file should match the one specified in the ssh_config file as IdentityFile.
The .ssh directory on both servers should have 700 permissions and should be owned by the owner of the home directory.
I think the problem was with the file permissions of may be $HOME/.ssh or the keys, I changed the file permission of $HOME/.ssh to 700 & it worked. Now its not asking for the password for the ssh user@destination.server.com command.
Thanks a lot to both of you.
Porter specially you, who kept me replying from the start.