File: ftppass

package info (click to toggle)
avfs 1.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,916 kB
  • sloc: ansic: 31,364; sh: 6,482; perl: 1,916; makefile: 351
file content (42 lines) | stat: -rwxr-xr-x 736 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh

if test -z "$1" ; then
  echo "usage: $0 username@[hostname]" 1>&2
  exit 1
fi

userhost=$1


if test -r "$AVFSBASE/#avfsstat" ; then
  basedir="$AVFSBASE"
elif test -r "$HOME/.avfs/#avfsstat" ; then
  basedir="$HOME/.avfs"
elif test -r "/#avfsstat" ; then
  basedir=
elif test -r "/overlay/#avfsstat" ; then
  basedir=/overlay
else
  echo "AVFS not running" 1>&2
  exit 1
fi

ctrlc () {
  stty $oldsetting
  echo
  exit 127
}

oldsetting=`stty -g`
printf "Password: "
trap ctrlc 2 3 15
stty -echo
read passwd < /dev/tty
stty $oldsetting
echo

echo $passwd | cp /dev/stdin $basedir/#ftp_ctl:$userhost/password

if [ -e "$basedir/#ucftp_ctl" ]; then
    echo $passwd | cp /dev/stdin $basedir/#ucftp_ctl:$userhost/password
fi