Debian Codegraph @

encryptedpw.sh

raw symbols SCIP
1 #!/bin/bash
2
3 # Example "ex72.sh" modified to use encrypted password.
4
5 # Note that this is still rather insecure,
6 #+ since the decrypted password is sent in the clear.
7 # Use something like "ssh" if this is a concern.
8
9 E_BADARGS=85
10
11 if [ -z "$1" ]
12 then
13 echo "Usage: `basename $0` filename"
14 exit $E_BADARGS
15 fi
16
17 Username=bozo # Change to suit.
18 pword=/home/bozo/secret/password_encrypted.file
19 # File containing encrypted password.
20
21 Filename=`basename $1` # Strips pathname out of file name.
22
23 Server="XXX"
24 Directory="YYY" # Change above to actual server name & directory.
25
26
27 Password=`cruft <$pword` # Decrypt password.
28 # Uses the author's own "cruft" file encryption package,
29 #+ based on the classic "onetime pad" algorithm,
30 #+ and obtainable from:
31 #+ Primary-site: ftp://ibiblio.org/pub/Linux/utils/file
32 #+ cruft-0.2.tar.gz [16k]
33
34
35 ftp -n $Server <<End-Of-Session
36 user $Username $Password
37 binary
38 bell
39 cd $Directory
40 put $Filename
41 bye
42 End-Of-Session
43 # -n option to "ftp" disables auto-logon.
44 # Note that "bell" rings 'bell' after each file transfer.
45
46 exit 0