问题
I have a small shell script test.sh
in Unix with the following content:
cd /usr/kerberos/sbin
echo l | ktutil
echo quit | ktutil
Its running fine in Unix and giving the output of ktutil
. However when I run from Windows using the PLINK.EXE
of PuTTY, its not running the ktutil
command properly. The output it gives is the usage of ktutil
.
Usage: ktutil [-hv] [--version] [--help] [--keytab=keytab to operate on] [-k keytab to operate on] [--verbose] command -k keytab to operate on, --keytab=keytab to operate on keytab -v, --verbose
Usage: ktutil [-hv] [--version] [--help] [--keytab=keytab to operate on] [-k keytab to operate on] [--verbose] command -k keytab to operate on, --keytab=keytab to operate on keytab -v, --verbose
The command I use in Windows is the following:
PLINK.EXE user@server /home/user/test.sh
回答1:
It is possible your environment isn't set correctly when accessing your user directly from PLINK.EXE
.
Check if there is an alias for your ktutil
command, from Unix:
type ktutil
A solution would be to define shell variables with the source
command, e.g. at the beginning of your test.sh
script:
source /home/myuser/.profile
来源:https://stackoverflow.com/questions/44847506/unable-to-run-shell-script-with-ktutil-command-from-windows-using-plink