avatar
a question in shell script# Unix - 噫吁兮,危乎高哉
w*s
1
How can I let others su me without entering password in a script? I know it
is dumb and dangous, but it seems it's the need.
Some previous posts said use "expect", while I can't find it in Sun.(I got
it in Linux machine) Can somebody tell me whether I can get it from Sun?
And if don't use "expect", is it possible for a shell script to talk and
control other process? Can I give the password to su in a script?
Thanks very much.
avatar
w*n
2
Find source code of expect and compile it is not so difficult. I did it on
Solaris, and use it to automate 'telnet bbs.mit.edu'.
I am a bit worried of putting plain text password in a script file, although
it is only a bbs password. But, I will never put plain text password for
unix user in a script.
However, if you are determined, go fetch expect.

【在 w********s 的大作中提到】
: How can I let others su me without entering password in a script? I know it
: is dumb and dangous, but it seems it's the need.
: Some previous posts said use "expect", while I can't find it in Sun.(I got
: it in Linux machine) Can somebody tell me whether I can get it from Sun?
: And if don't use "expect", is it possible for a shell script to talk and
: control other process? Can I give the password to su in a script?
: Thanks very much.

avatar
l*l
3
Why not use suid shell?
you can do this:
cp /bin/sh to some directory,
then
chmod a+s sh
Ok now! When others exec this suid sh, they will get your id.
And more, bash scripts can't support suid, while korn shell can support
suid.

【在 w********s 的大作中提到】
: How can I let others su me without entering password in a script? I know it
: is dumb and dangous, but it seems it's the need.
: Some previous posts said use "expect", while I can't find it in Sun.(I got
: it in Linux machine) Can somebody tell me whether I can get it from Sun?
: And if don't use "expect", is it possible for a shell script to talk and
: control other process? Can I give the password to su in a script?
: Thanks very much.

avatar
w*s
4
It's so cool! wow! Thanks

【在 l*l 的大作中提到】
: Why not use suid shell?
: you can do this:
: cp /bin/sh to some directory,
: then
: chmod a+s sh
: Ok now! When others exec this suid sh, they will get your id.
: And more, bash scripts can't support suid, while korn shell can support
: suid.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。