From host B I can SSH various other hosts (C, D) without using any password as I put the public key in the correspondent authorized_keys files (in hosts C and D).
From host A I can SSH host B (via password authentication). However, once I am logged into host B I need to authenticate my key each time when I connect to C and D (even if in principle this should not be the case).
To summarize, if I connect directly to host B (e.g office) I do not need to type any password to connect to C or D. If I connect to A (e.g. home) and then from A I connect to B, once I am in B I need passwords to connect to D or C. I can partially solve the problem by adding the password to an ssh-agent (using ssh-add), but every time I open a new shell in B I need to do this again.
Update
Thanks to the useful comments, it turned out that the problem is the following. When I connect directly to B there is a keyring program running (in my specific case this is seahorse). Therefore the passwords of all encrypted private keys can be used automatically. When I connect to B from A this does not happen. For a mysterious reason even if I start a remote session (vnc / remmina) from A to B the program seahorse is not active in B and hence I have to manually insert the passwords over and over.
I installed keychain and the problem has been solved.
However, I am not sure if it is worth to encrypt a private key which is only used for SSH connection to a specific server. Is there any concrete security risk by not encrypting the private keys? In principle if one is able to access the private key he/she is also able to use the passwords stored in the keychain...so it seems that there might not be a big advantage in encrypting the private keys.
SSH_AUTH_SOCK
environment variable.