Setting Up a Trusted Computer

This page shows how to set up password-less access to shell and to sftp from your home Mac desktop or Mac laptop. For a Windows computer, use PuTTY or install Cygwin.

Enter your username , then copy these lines [these lines depend on your username] as one block and paste, do not type, in Terminal, and enter your TU password when prompted:

SSH=`which ssh`
SSH="$SSH -o StrictHostKeyChecking=no -q"
CAT=`which cat`
MKDIR=`which mkdir`
SSHDIR="$HOME/.ssh"
SERVER='shell.cst.temple.edu'
PRIVATEKEY="$SSHDIR/$SERVER"
PUBLICKEY="${PRIVATEKEY}.pub"
RM=`which rm`
REMOTESSHDIR=".ssh"
AUTHORIZEDKEYS="$REMOTESSHDIR/authorized_keys"
CONFIG="$SSHDIR/config"
CHMOD=`which chmod`

COMMAND="
if ! [[ -d $REMOTESSHDIR ]]; then /usr/bin/mkdir $REMOTESSHDIR; fi
/usr/bin/chmod 0700 $REMOTESSHDIR
/usr/bin/cat >> $AUTHORIZEDKEYS
/usr/bin/chmod 0600 $AUTHORIZEDKEYS
"

if [[ -e $PRIVATEKEY ]]; then $RM $PRIVATEKEY; fi
/usr/bin/ssh-keygen -q  -t rsa -b 2048 -N '' -f $PRIVATEKEY
$CAT $PUBLICKEY | $SSH username@$SERVER "$COMMAND"

$CAT >> $CONFIG << EOF 
host $SERVER
        User username
        StrictHostKeyChecking=no
        IdentityFile ~/.ssh/$SERVER

host shell
	Hostname $SERVER
EOF

$CHMOD 600 $CONFIG

cd ~/.ssh
if ! [ -e id_rsa]; then ln -s $SERVER id_rsa; ln -sf $SERVER.pub id_rsa.pub; fi

Now ssh-ing to the server shell.cst.temple.edu or sftp-ing to the server sftp.cst.temple.edu will no longer require a password.