sftp icon indicating copy to clipboard operation
sftp copied to clipboard

.ssh/authorized_keys are appended

Open MartinHajducik opened this issue 4 years ago • 2 comments

Hello community,

recently we noticed when we add new user public keys, those are appended. Would it be maybe more elegant to clean that file and rewrite it every time sftp is redeployed ? Instead of >> just >

Image situation where you want to remove access to specific key, but file which is appended will still contain it.

https://github.com/atmoz/sftp/blob/302390e67cdd589702f887ddbf0ea7b2d9a877aa/files/create-sftp-user#L90

Thanks for inputs Martin

MartinHajducik avatar Oct 07 '21 12:10 MartinHajducik

~/.ssh/authorized_keys (userKeysAllowedFile) is in fact overwritten each time: https://github.com/atmoz/sftp/blob/302390e67cdd589702f887ddbf0ea7b2d9a877aa/files/create-sftp-user#L94

because userKeysAllowedFileTmp is always a new file: https://github.com/atmoz/sftp/blob/302390e67cdd589702f887ddbf0ea7b2d9a877aa/files/create-sftp-user#L86

Do you create a new container each time or just restart?

atmoz avatar Oct 07 '21 18:10 atmoz

~/.ssh/authorized_keys (userKeysAllowedFile) is in fact overwritten each time:

https://github.com/atmoz/sftp/blob/302390e67cdd589702f887ddbf0ea7b2d9a877aa/files/create-sftp-user#L94

because userKeysAllowedFileTmp is always a new file:

https://github.com/atmoz/sftp/blob/302390e67cdd589702f887ddbf0ea7b2d9a877aa/files/create-sftp-user#L86

Do you create a new container each time or just restart?

Hi, we have been using docker pull atmoz/sftp:alpine-3.7 which seems to be problem. Updated to alpine tag and now file is being recreated.

MartinHajducik avatar Oct 08 '21 11:10 MartinHajducik