atmoz / sftp

Securely share your files
https://hub.docker.com/r/atmoz/sftp/
MIT License
1.66k stars 834 forks source link

.ssh/authorized_keys are appended #286

Open MartinHajducik opened 3 years ago

MartinHajducik commented 3 years ago

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

atmoz commented 3 years ago

~/.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?

MartinHajducik commented 3 years ago

~/.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.