Sign inSign up

tsingjyujing/ssh-np

By tsingjyujing

•Updated over 5 years ago

SSH No Password Login

Image
0

2.3K

tsingjyujing/ssh-np repository overview

⁠SSH No Password Login

⁠Introduction

This a docker image based on ubuntu optimized for File Transfer via SFTP protocal.

Features:

  • Safe: no password, no password leaking problem ❤️
  • Easy: a docker run is everything you need
  • Lite: only consume several mega bytes memory

⁠Quick Start

⁠Key Preparation

Actually, I assumed you're already know how to generate your key pairs, but if you lost your memory unfortunatlly, please follow these steps:

ssh-keygen -t rsa

To generate a pair of keys in RSA.

⁠Server Side

On server, you need to prepare your docker environment by this document⁠, then run:

docker run -it \ # You'd better to run with -it and the container will exit after use, you may also use -d to keep it background
    -p 60789:22 \ # Of course you can specify port, if you not specify, docker will find a free port for you
    --cpus=1 -m 500M \ # For safety you'd better to limit resource
    -v $PWD/key/:/key \ # This is the place where you put your *.pub files, change `$PWD/key/` to your place
    -v $PWD/data/:/data \ # This is the dir you want to expose, change `$PWD/data/` to your place
    tsingjyujing/ssh-np:latest
⁠Client Side
⁠Using SSH to login directly

The reference command of ssh is:

ssh \
    -i key/id_rsa \ # This is the place where your private key
    -o StrictHostKeychecking=no \ # Don't check
    -o UserKnownHostsFile=/dev/null \ # Don't remeber the host info
    [email protected] -p 60789 

It's convient if you're using FileZilla, WinScp or some other SFTP client, the most important is to specify the private key file.

⁠Using SSHFS

If you're using MAC or Linux for working, congratulations! It has a convient way to connect the server.

sshfs \
    -o IdentityFile=$PWD/key/id_rsa \ # Must be the full path
    -o StrictHostKeychecking=no \ # Don't check
    -o UserKnownHostsFile=/dev/null \ # Don't remeber the host info
    -o port=60789 \ # Specify the port
    [email protected]:/data \ # Which server you want to connect
    mount  # You'd better specify a empty dir for mount the files

Tag summary

Content type

Image

Digest

Size

64.8 MB

Last updated

over 5 years ago

docker pull tsingjyujing/ssh-np