Unable to run shell script with ktutil command from Windows using PLINK

巧了我就是萌 提交于 2020-01-03 00:27:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!