Hi,
I have got a shell script, which fails to run properly..
I am getting the following error:
"Pseudo-terminal will not be allocated because stdin is not a terminal.
Permission denied (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive)."
I SSH to the machine and then run the following Shell script..
#!/bin/sh
# Configuration vars
ServerMap="/usr/local/scripts/SeverMaps.txt"
Ssh="/usr/bin/ssh"
PATH=/usr/bin:$PATH
##############################################################
#
# Functions
#
ErrorExit() {
echo $1
echo "Press \"Enter\" to exit."
# Wait for user to press "enter", we are not intereseted in anything else
read SomeThing
exit
}
PrintHelp() {
echo
echo "Version $Version"
echo
ErrorExit " "
return
}
##############################################################
#
# Main Body
#
# $1 is "Location", $2 is "Node"
#
# Make sure both vars are present
if [ "$1" = "-v" ]; then
echo
echo "-v switch specified, printing version number:"
echo "Version $Version"
echo
exit
fi
if [ -z "$2" ]; then
echo ""
echo "Error: Missing arguments"
echo "Location = $1, Node = $2."
PrintHelp
fi
# Make sure the USER env var is present
if [ -z "$USER" ]; then
ErrorExit "Error: Environment not set correcty (USER not specified)."
fi
# Get a count of lines matching $1, more or less than one is invalid.
Count=`cat $ServerMap | grep -v "#" | grep -c "^$1"`
if [ $Count -ne 1 ]; then
ErrorExit "Error: Too many or no matches for Location name $1 in map file. ($Count)"
fi
# Get the name of the remote server
Server=`grep "^$1" $ServerMap | grep -v "#" | awk '{print $2}'`
if [ -z "$Server" ]; then
ErrorExit "Error: Server name for $1 not specifed in map file."
fi
# Get this server FQDN
ThisServer="`hostname | cut -d . -f 1`.`cat /etc/resolv.conf | grep domain | awk '{print $2}'`"
if [ "$ThisServer" = "$Server" ]; then
# We are launching from the same server, no need to ssh
# Let the user know what is happening.
echo "SSH to device $2"
# Call the command line
$Ssh -t $USER@$2
else
# Server is a remote server, we need to ssh
# Call the command line
$Ssh -t $USER@$Server $NcoPipe $SshR -t $USER@$2
fi
Could someone help me figure out, why this error comes up, and how i can resolve this issue??
Thanks In Advance,
Blub:)