Why is it that from my home directory I can use SSH with public key authentication to log into another host without being prompted for a password?
ccd (home_dir)
ready 14:24:53
display_current_dir
%azvos#m17_mas>SysAdmin>Noah_Davids
ready 14:24:58
ssh [email protected]
WARNING: Unauthorized access to this system is forbidden and will be
prosecuted by law. By accessing this system, you agree that your
actions may be monitored if unauthorized usage is suspected.
Noah_Davids.CAC logged in on %phx_vos#m16 at 13-05-23 14:25:14 mst.
ready 14:25:14
|
Figure 1 – login using a public key from my home directory works correctly |
And yet from a different directory I can’t
display_current_dir
%azvos#m17_d02>noah
ready 14:26:51
ssh [email protected]
Could not create directory '/%azvos#m17_d02/SysAdmin/Noah_Davids/.ssh'.
The authenticity of host '192.168.12.128 (192.168.12.128)' can't be established.
RSA key fingerprint is 37:f4:1a:56:64:af:ab:8a:7c:0b:36:47:c5:6c:1d:1a.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/%azvos#m17_d02/SysAdmin/Noah
+_Davids/.ssh/known_hosts).
WARNING: Unauthorized access to this system is forbidden and will be
prosecuted by law. By accessing this system, you agree that your
actions may be monitored if unauthorized usage is suspected.
[email protected]'s password:
Noah_Davids.CAC logged in on %phx_vos#m16 at 13-05-23 14:27:37 mst.
ready 14:27:37
|
Figure 2 – login using a public key from some other directory doesn’t work |
The key is in the error message
“Could not create directory ‘/%azvos#m17_d02/SysAdmin/Noah_Davids/.ssh’.”
SSH is looking for my .ssh directory under /SysAdmin/Noah_Davids but it is looking for it on the wrong disk, #m17_d02 instead of #m17_mas. As the fourth line in figure 1 shows, my home directory is #m17_mas>SysAdmin>Noah_Davids but as the second line in figure 2 shows my current directory is on a different disk, #m17_d02 instead of #m17_mas. SSH is looking on the wrong disk because in the user registration database my home directory is listed as >SysAdmin>Noah_Davids.
If you look at the links under #m17_d02 you will see that nothing points back to the SysAdmin directory under #m17_mas so SSH cannot find my home directory.
display_current_dir
%azvos#m17_d02
ready 14:32:22
list -links
Links: 5
O -> %azvos#m17_mas>Overseer
opt -> %azvos#m17_mas>opt
Overseer -> %azvos#m17_mas>Overseer
rel -> %azvos#m17_d02>release_dir
system -> %azvos#m17_mas>system
ready 14:32:29
|
Figure 3 – links under the root of #m17_d02 |
Once the link is added
display_current_dir
%azvos#m17_d02
ready 14:33:09
link #m17_mas>SysAdmin SysAdmin
ready 14:33:24
list -links
Links: 6
O -> %azvos#m17_mas>Overseer
opt -> %azvos#m17_mas>opt
Overseer -> %azvos#m17_mas>Overseer
rel -> %azvos#m17_d02>release_dir
SysAdmin -> %azvos#m17_mas>SysAdmin
system -> %azvos#m17_mas>system
ready 14:33:32
|
Figure 4 – Adding a link #m17_d02 to (master_disk)>SysAdmin |
It works.
display_current_dir
%azvos#m17_d02>noah
ready 14:34:50
ssh [email protected]
WARNING: Unauthorized access to this system is forbidden and will be
prosecuted by law. By accessing this system, you agree that your
actions may be monitored if unauthorized usage is suspected.
Noah_Davids.CAC logged in on %phx_vos#m16 at 13-05-23 14:34:58 mst.
ready 14:34:58
|
Figure 5 – login using a public key from some other directory now works |
If for whatever reason I did not want to create the link, another solution would have been to change my home directory in the registration database from >SysAdmin>Noah_Davids to the absolute path %azvos#m17_mas>SysAdmin>Noah_Davids. However, that would only work for me, while adding the link would work for everyone with a home directory under SysAdmin. Also changing my home directory to an absolute path would be problematic in a multi-module system if my home directory module where down or could not communicate with my login module. Creating the link is a much better approach.