README (4255B)
1 Intro 2 ------ 3 t4t is a minimal, consent-based paste service designed to be used amongst trusted friends. 4 It consists of two scripts: t4t, and t4t-receive. 5 6 t4t uploads files to T4T_HOST over ssh, which prompts t4t-receive to write the received data 7 to the specified file. This is accomplished through setting up your authorized_keys in a certain way; 8 see 'SIMPLE SETUP' below. 9 10 Usage - t4t 11 ------------ 12 t4t [-u user] [-h host] [files...] 13 14 DESCRIPTION 15 Pipes the given files to user@host through ssh. If no files are specified, 16 or '-' is passed as a filename, t4t will read from stdin. 17 18 T4T_USER and T4T_HOST define which user to connect as, and which host to 19 connect to. The former defaults to 't4t', and the latter has no default. 20 21 OPTIONS 22 -u user 23 Specify which username to use when connecting over ssh. This overrides 24 T4T_USER. 25 -h host 26 Specify which host to connect to over ssh. This overrides T4T_HOST. 27 28 Usage - t4t-receive 29 -------------------- 30 SYNOPSIS 31 t4t-receive [-B blacklist] [-d dir] [-l limit] [-M | -m mimefile] [-r root] 32 [-S | -s profile] [-t tmp] [-u url] [name] 33 34 DESCRIPTION 35 Writes file data from stdin to root/name (~/www by default). 36 37 Name is inferred through SSH_ORIGINAL_COMMAND. If this variable is unset, 38 t4t-receive will use the command line option. If no name has been specified 39 on the command line, it will generate a random name automatically. 40 41 If a file with the given name exists, t4t-receive appends random characters 42 to the given name until it is unique. 43 44 After a successful write, t4t-receive prints a URL to the uploaded file, 45 constructed with the help of url. 46 47 If -S is not set, t4t-receive sources the shell profile (~/.profile 48 by default) for relevant variables. All shell variables are overridden by 49 their command line option counterparts (see below) 50 51 OPTIONS 52 -B blacklist 53 Defines a space-delimited list of extensions to be stripped from name. 54 Its corresponding shell variable is T4T_BLACKLIST. 55 56 -d dir 57 Write to subdirectory dir in root. Its corresponding shell variable 58 is T4T_DIR. 59 60 -l limit 61 Defines the maximum file size for the incoming data. limit may 62 optionally be followed by a unit multiplier, much like dd. e.g. 63 KB, MB, GB, TB. Negative numbers correspond to unlimited file size. 64 Its corresponding shell variable is T4T_LIMIT. The default is '-1'. 65 66 -M 67 Do not attempt to guess an appropriate extension based on the file's 68 MIME type. 69 70 -m 71 Defines the file to consult for extensions. Its corresponding shell 72 variable is T4T_MIME. The default is '/usr/share/t4t/mime.types'. 73 Using '/etc/mime.types' may result in nonsensical extensions. 74 75 -r root 76 Defines the root directory to write to. Its corresponding shell 77 variable is T4T_ROOT. 78 79 -S 80 Do not source profile for environment variables. 81 82 -s profile 83 Defines the file to source for environment variables. 84 85 -t tmp 86 Defines the directory to store intermediary files in. Its corresponding 87 shell variable is T4T_TMP. The default is '/tmp'. 88 89 -u url 90 Defines the url to display in the output. Its corresponding shell 91 variable is T4T_URL. 92 93 SIMPLE SETUP 94 Create a user account and home directory that clients will connect to. 95 It is recommended to choose 't4t' as the name. Ensure that this user is able 96 to accept incoming ssh connections. 97 98 Define the default variables in .profile. T4T_ROOT and T4T_URL are required. 99 It is recommended to change T4T_MIME to the correct path depending on your 100 distribution and installation. 101 102 Create a line for each authorised user in your .ssh/authorized_keys file like so: 103 command="t4t-receive -l -1 -B ''" ssh-rsa ...public key for owner 104 command="t4t-receive -l 100M -d aaron" ssh-rsa ...public key for aaron 105 command="t4t-receive -d bill" ssh-rsa ...public key for bill 106 command="t4t-receive -d cynthia" ssh-rsa ...public key for cynthia 107 ...etc 108 109 Users may now leverage the t4t script described above, or upload directly 110 over ssh: 111 ssh -T t4t@[host] [name] <FILE