0

This question already has an answer here:

Password less SSH without user directory?

The folder .ssh should be stored in a user directory as far as I understood.

ServerA: Linux without /home/users
ServerB: Linux with /home/users
client:  Linux/mac etc...

Cases:

  • client password-less ssh to ServerB, no problem
  • client password-less ssh to ServerA, no problem
  • SeverA password-less ssh to ServerB, problem!

If there is no actual user directories in ServerA how public key for each user without user directory existing?

Or is there other ways to safely ssh to ServerB from ServerA?

marked as duplicate by RobertL, Community Dec 30 '15 at 17:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • At least with OpenSSH, you can set an alternate AuthorizedKeysFile such as /etc/ssh/user/authorized_keys via the sshd_config file. Is that what you are asking about? – steeldriver Dec 30 '15 at 16:03
  • Do invalid home directory entries exist in the /etc/passwd files on ServerA and ServerB? – RobertL Dec 30 '15 at 16:05
  • This appears to be a client, not server, issue. More information is needed to accurately solve the problem. What is the meaning of "SeverA passwordless ssh to ServerB, problem"? What config did you use, what command did you invoke, and what output do you see? Have you looked at the output of ssh -v or ssh --trace-ascii on ServerA or ServerB? – RobertL Dec 30 '15 at 16:13
  • sorry, Guys, All I know is Server A is centOS, ServerB is an old machine with SGE qsub. – Gang Dec 30 '15 at 16:31
  • It is what I expected for my qestions. better close now to avoid wasting everyone 's time. Robert. thanks – Gang Dec 30 '15 at 17:17
1

it is possible to change the authorized keys file location by modifying or adding an entry to /etc/ssh/sshd_config file as such:

AuthorizedKeysFile /etc/ssh/.authorized_keys

don't forget to restart sshd after the modification of course

  • Since the questioner can log in to A or B with a properly configured client, it appears that the client ssh on A and/or B is misconfigured. Can this answer solve that issue? – RobertL Dec 30 '15 at 16:16
1

ssh provides an option -i that can point to any file that has the pub key. For example,

serverA ~]# ssh -i /path/to/pub/id_rsa username@serverB
  • I think this might work-around the problem, though doesn't appear to be a solution, because questioner is asking about "ssh setup", implying configuration. Unfortunately, at this point in time, the question does not provide enough information. – RobertL Dec 30 '15 at 16:20
  • Yes, the question is two fold. This might answer part of the question where the use wants to ssh witohut password and wants to store keys in non default location. – iamauser Dec 30 '15 at 16:23
  • Do you think the question provides sufficient information to solve the problem? – RobertL Dec 30 '15 at 16:26
  • I would try this tomorrow, my vpn is down today, thanks and sorry for not able to provide enough information – Gang Dec 30 '15 at 16:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.