Unable to run shell script with ktutil command fro

2019-05-30 02:49发布

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条回答
Juvenile、少年°
2楼-- · 2019-05-30 03:45

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
查看更多
登录 后发表回答