无法使用 PLINK 从 Windows 使用 ktutil 命令运行 shell 脚本 [英] Unable to run shell script with ktutil command from Windows using PLINK
问题描述
我在 Unix 中有一个小的 shell 脚本 test.sh
,内容如下:
I have a small shell script test.sh
in Unix with the following content:
cd /usr/kerberos/sbin
echo l | ktutil
echo quit | ktutil
它在 Unix 中运行良好,并给出 ktutil
的输出.但是,当我使用 PuTTY 的 PLINK.EXE
从 Windows 运行时,它没有正确运行 ktutil
命令.它给出的输出是 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
.
用法:ktutil [-hv] [--version] [--help] [--keytab=keytab 操作][-k keytab 操作] [--verbose] 命令-k keytab 操作,--keytab=keytab 操作keytab-v, --verbose
用法:ktutil [-hv] [--version] [--help] [--keytab=keytab 操作][-k keytab 操作] [--verbose] 命令-k keytab 操作,--keytab=keytab 操作keytab-v, --verbose
我在 Windows 中使用的命令如下:
The command I use in Windows is the following:
PLINK.EXE user@server /home/user/test.sh
推荐答案
当直接从 PLINK.EXE
访问您的用户时,您的环境可能设置不正确.
It is possible your environment isn't set correctly when accessing your user directly from PLINK.EXE
.
检查是否有来自 Unix 的 ktutil
命令的别名:
Check if there is an alias for your ktutil
command, from Unix:
type ktutil
一个解决方案是使用 source
命令定义 shell 变量,例如在 test.sh
脚本的开头:
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
这篇关于无法使用 PLINK 从 Windows 使用 ktutil 命令运行 shell 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!