You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we instead use -v <host-dir>/ssh.keys:/home/foo/.ssh/keys:ro, a whole host directory is mounted where users can add whichever keys they want. But if the user doesn't add any keys, image startup still fails.
Since it's hard to have a docker-compose file that adds a volume conditionally on the host dir being non-empty, it'd be nice if the image could gracefully handle the situation, e.g. by setting shopt -s nullglob or by testing the result of the attempted glob before trying to cat it. Testing the potential filename with -f before catting it would probably also help with #350.
Reproduction steps
mkdir -p /tmp/test/ssh.keys
(optional) touch /tmp/test/ssh.keys/.gitkeep
docker run --rm -it --env SFTP_USERS=foo:foo:1001 -v /tmp/test/ssh.keys:/home/foo/.ssh/keys:ro atmoz/sftp:latest
Expected results
Container runs. No keys are configured.
Actual results
[/usr/local/bin/create-sftp-user] Parsing user data: "foo:foo:1001"
cat: '/home/foo/.ssh/keys/*': No such file or directory
/usr/local/bin/create-sftp-user: Error on line 90: cat "$publickey" >> "$userKeysAllowedFileTmp"
/entrypoint: Error on line 60: create-sftp-user "$user"
The text was updated successfully, but these errors were encountered:
For others who may run into this, we added a simple README file that describes the folder's purpose, which worked to prevent the error. Automattic/jetpack#32588
Following the instructions at https://github.com/atmoz/sftp#logging-in-with-ssh-keys, if the specified keys don't exist then you get #350, plus your docker-compose configuration needs to list every key the user might want to specify.
If we instead use
-v <host-dir>/ssh.keys:/home/foo/.ssh/keys:ro
, a whole host directory is mounted where users can add whichever keys they want. But if the user doesn't add any keys, image startup still fails.Since it's hard to have a docker-compose file that adds a volume conditionally on the host dir being non-empty, it'd be nice if the image could gracefully handle the situation, e.g. by setting
shopt -s nullglob
or by testing the result of the attempted glob before trying tocat
it. Testing the potential filename with-f
before catting it would probably also help with #350.Reproduction steps
mkdir -p /tmp/test/ssh.keys
touch /tmp/test/ssh.keys/.gitkeep
docker run --rm -it --env SFTP_USERS=foo:foo:1001 -v /tmp/test/ssh.keys:/home/foo/.ssh/keys:ro atmoz/sftp:latest
Expected results
Container runs. No keys are configured.
Actual results
The text was updated successfully, but these errors were encountered: