Create a gist now

Instantly share code, notes, and snippets.

$ easy_install sftpserver
# create ssh_key
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/sci01436/.ssh/id_rsa): ./test_rsa.key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ./test_rsa.key.
Your public key has been saved in ./test_rsa.key.pub.
The key fingerprint is:
7b:27:13:c8:a3:5d:ee:2b:35:1a:f8:eb:97:05:20:9b sci01436@dev_esssmtp001
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . . |
| + . |
| E. .. |
| .S o. |
| .o.=o.. |
| ..o+=+. |
| +oo+ |
| .o+o. |
+-----------------+
# you can exec sftpserver from shell.
# but I exec it from python.
$ python
>>> import sftpserver
>>> keyfile = './keys/test_rsa.key'
>>> sftpserver.start_server('127.0.0.1', 3373, keyfile, 'INFO')
$ sftp -oPort=3373 -oIdentityFile=./test_rsa.key localhost
Connecting to localhost...
The authenticity of host '[localhost]:3373 ([127.0.0.1]:3373)' can't be established.
RSA key fingerprint is 7b:27:13:c8:a3:5d:ee:2b:35:1a:f8:eb:97:05:20:9b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:3373' (RSA) to the list of known hosts.
sci01436@localhost's password: (empty password and enter)
# OK!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment