Created
October 19, 2020 02:00
-
-
Save ctrlcctrlv/fa19e7bbb1e594cd2fb96e7690f90d94 to your computer and use it in GitHub Desktop.
Launch an FTP server for each drive letter (MSYS2 / pyftpdlib)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # A problem I commonly experience on Windows is wanting to access all files via | |
| # another computer on the network running Linux or a phone running Android. | |
| # | |
| # While it is technically possible to use Samba shares, this is annoying to set | |
| # up. Usually I just spawn FTP servers. But an annoying thing about Windows is | |
| # its concept of multiple roots. While it's also possible to "mount" a drive | |
| # letter under C:\ in Windows I think, this is also annoying to set up. | |
| # | |
| # So, I use this script. Running as: | |
| # | |
| # $ ./ftp_servers_launch.sh risingsun | |
| # | |
| # Will start FTP servers for each drive letter with the password "risingsun". | |
| # Requires MSYS2 and pyftpdlib be installed. (/usr/bin/pip3.8 install | |
| # pyftpdlib) | |
| # | |
| # (3.8 is Python3 version.) | |
| DRIVES=(a b c d e f g h i j k l m n o p q r s t u v w x y z) | |
| if [ -z "$1" ]; then | |
| >&2 echo "No password supplied!" | |
| exit 1 | |
| fi | |
| NUMDRIVES=0 | |
| for DRIVE in ${DRIVES[@]}; do | |
| if [ -d /$DRIVE ]; then | |
| echo /usr/bin/python3.8 -m pyftpdlib -p $((3000+$NUMDRIVES)) -d /$DRIVE/ -i 0.0.0.0 -u $DRIVE -P "$1" '&' | |
| /usr/bin/python3.8 -m pyftpdlib -p $((3000+$NUMDRIVES)) -d /$DRIVE/ -i 0.0.0.0 -u $DRIVE -P "$1" & | |
| NUMDRIVES=$((NUMDRIVES+1)) | |
| echo Spawned : $! | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment