I am writing a kickstart install script that will set up a user on a server with the previous files and permissions it held before. The user I am setting up has ssh keys located in .ssh/
that I also copy over so that the authentication is not required to be set up again.
However every time I attempt to ssh to the server the keys are set up for, I am prompted for the password.
It was working after I set up the keys but has stopped working after I created the same user name with the keys that were originally created. I've checked permissions of the files and they are the same in .ssh
.
Is this process possible?
Edit to show /var/log/secure on target server
Setting up as new user with ssh keys:
Jul 1 10:24:01 myuser sshd[14957]: Accepted password for targetserveruser from 192.168.55.55 port 33176 ssh2
Jul 1 10:24:02 myuser sshd[14957]: pam_unix(sshd:session): session opened for user targetserveruser by (uid=0)
Jul 1 10:24:02 myuser sshd[14977]: Received disconnect from 192.168.55.55: 11: disconnected by user
Jul 1 10:24:02 myuser sshd[14957]: pam_unix(sshd:session): session closed for user targetserveruser
Jul 1 10:24:21 myuser sshd[14980]: Accepted password for targetserveruser from 192.168.55.55 port 33177 ssh2
Jul 1 10:24:21 myuser sshd[14980]: pam_unix(sshd:session): session opened for user targetserveruser by (uid=0)
Jul 1 10:24:22 myuser sshd[14997]: Received disconnect from 192.168.55.55: 11: disconnected by user
Jul 1 10:24:22 myuser sshd[14980]: pam_unix(sshd:session): session closed for user targetserveruser
Jul 1 10:24:33 myuser sshd[15002]: Connection closed by 192.168.55.55 [preauth]
After repeating key copy process ssh-copy-id (I changed the key shown for security)
Jul 1 10:26:28 myuser sshd[15058]: Accepted publickey for targetserveruser from 192.168.55.55 port 33180 ssh2: RSA 3c:40:a1:dc:6d:05:1e:27:6b:b2:b5:98:f8:58:b6:96
Jul 1 10:26:28 myuser sshd[15058]: pam_unix(sshd:session): session opened for user targetserveruser by (uid=0)
Jul 1 10:26:28 myuser sshd[15061]: Received disconnect from 192.168.55.55: 11: disconnected by user
Jul 1 10:26:28 myuser sshd[15058]: pam_unix(sshd:session): session closed for user targetserveruser
Jul 1 10:26:28 myuser sshd[15064]: Accepted publickey for targetserveruser from 192.168.55.55 port 33181 ssh2: RSA 3c:40:a1:dc:6d:05:1e:27:6b:b2:b5:98:f8:58:b6:96
Jul 1 10:26:28 myuser sshd[15064]: pam_unix(sshd:session): session opened for user targetserveruser by (uid=0)
Jul 1 10:26:28 myuser sshd[15071]: Received disconnect from 192.168.55.55: 11: disconnected by user
Jul 1 10:26:28 myuser sshd[15064]: pam_unix(sshd:session): session closed for user targetserveruser
The log shows there is definitely a different process taking place. Even though the authorised keys is present on both runs with the same permission.
Is there another file somewhere that would need to be updated?