sh: /usr/local/bin/stty: not found ??

Im trying to use the command expect (installed correctly) and im getting the next error, can anyone help please??
what should i do?

#!/usr/bin/expect -f

spawn ssh user@machine2 data/

expect "Password:"

send "pass001\r"
error turned:

Open in new window

sh: /usr/local/bin/stty: not found
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

For some reason your expect implementation "expects" stty to reside in /usr/local/bin.

Now the usual place is /usr/bin, so you could create a link (while logged in as root) and retry:

ln -s /usr/bin/stty /usr/local/bin/stty

If /usr/local/bin does not exist create it beforehand (again, as root)  with "mkdir /usr/local/bin"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
celticianAuthor Commented:
ok, then should i contact the system admin to do so?? (i'm not)

Yes, you should. On standard systems /usr/local and /usr/local/bin (if present) are not writeable by regular users.

Perhaps this admin can also tell you why expect would search stty in /usr/local/bin! This should only happen when the expect binary has been compiled from source at your location.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Also on other flavors it resides in /usr/bin/stty.
---- Ooops already posted :p
I wonder about the file data/ that your ssh command is requesting be run on the target machine. Is it possible that the error message you are seeing returned is coming from the remote session rather than a local message?
Good point!
celticianAuthor Commented:
Ok, it seems to be solved now, but just to clarify some things:

I didnt have expect installed and i asked my system admin to install expect for me, so he probably used my username or installed it just for me as these are very large machines (this is a very large company) with tens of thousands of users.
Wouldn't it have been better convincing your admin to set up passwordless (public-key) ssh acces for your userid on the source machine to "user" on "machine2"?
celticianAuthor Commented:
Yes, of course, but the permissions in that folder (777) don't allow ssh to be used...
celticianAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for celtician's comment #a40729820

for the following reason:

I gave that sentene to the system admin and now im not getting the error anymore.the script is not working yet though :)
Didn't any of our answers help you?
celticianAuthor Commented:
Ooops i clicked in my own answer by mistake, i have changed that, points should have been asigned now.
Thank you!

And if "the script is not working yet though" - we are always here to help. Please don't hesitate to ask for assistance!
celticianAuthor Commented:
ill post another question. thanks!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.