- SSH, SCP, Rsync services in a Docker container.
- This container only accepts ssh-key auth.
You must put at least 1 valid public key in './files/' before building.
Anything matching ./files/*.pub
will be added to /etc/authorized_keys
before sshd starts.
Edit /etc/authorized_keys
to modify keys after container is running.
- Install Docker
- Clone this repo:
git clone https://github.com/jhazelwo/ssh-docker.git
- Copy your public key
cp ~/.ssh/id_rsa.pub ./ssh-docker/files/
- Build the image
cd ssh-docker; ./Build.sh
- Start a container from that image.
./Go.sh
- To use a different port change Port in
./files/sshd_config
- To map a path from host to container,
update $Map variable in
./Go.sh
rsync -av --progress -e 'ssh -p 22022 -l data -i ~/.ssh/id_rsa' remote.host.tld:*.zip .
rsync -av --progress -e 'ssh -p 22022 -l data -i ~/.ssh/id_rsa' *.zip remote.host.tld:.
ssh -l data -p 22022 -i ~/.ssh/id_rsa remote.host.tld
scp -P 22022 -i ~/.ssh/id_rsa *.zip data@remote.host.tld:.
note: Use upper-case P for 'Port' when using scp.
scp -P 22022 -i ~/.ssh/id_rsa data@remote.host.tld:*.zip .
note: Use upper-case P for 'Port' when using scp.
# If you put key, user and port in ~/.ssh/config you don't have to
# include them in your commands.
Host remote.host.tld
HostName remote.host.tld
User data
IdentityFile ~/.ssh/remote_host_PRIVATE_key
Port 22022