Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
kindly help me on below issue .
i want to connect to remote server through SFTP .
i am using below commands .
but still it is not taking the password and keeps the screen hold for password .
=======================================
sftp -v userid@serverhost
sleep 1
expect Password:
send "password\n"
=======================================
hello all ,
kindly help me on below issue .i want to connect to remote server through SFTP .
i am using below commands . but still it is not taking the password and keeps the screen hold for password .
=======================================
sftp -v userid@serverhost
sleep 1
expect Password:
send "password\n"
=======================================
Again, as with your other thread, you're not providing full details/goals. One of the BIG advantages of SSH/SCP/SFTP, is that you can do passwordless logins by doing a secure keyswap. This not only makes things secure, but keeps you from having to put a password into a script, WHICH IS A BAD IDEA. You're making a secure process INSECURE.
yes i agree , but our system port and host may be change so i need to connect using password only .
i am using expect command but it is giving me error as
expect: command not found
send: command not found
i am not sure if i need to declare or define expect and send command somewhere ....
Hi ,
yes i agree , but our system port and host may be change so i need to connect using password only.
Sorry, but a changing port/host isn't a good reason to not use passwordless connection. It's TRIVIAL to change a script to use a different port, and takes a few seconds (one time!), to upload your key. Adding the flag to use a different port will also take a few seconds to any script you have. And really...how often would your port/host actually be changing?? Unless it's changing a few times a day, there's no reason to use expect. Even IF your host/port changed every single morning, it would probably take you less than one minute to modify your script to work.
Quote:
i am using expect command but it is giving me error as
expect: command not found
send: command not found
i am not sure if i need to declare or define expect and send command somewhere ....
plz help me ASAP...thanks..
You need to spell out your words, and don't use things like ASAP. We VOLUNTEER our time here, so telling us to hurry up and help you is fairly rude. And since you don't post your script, it's hard to tell you why it's not working. Post your script and we can try to help...but the first thing to check, would be to make sure that you have expect installed on your system.
Apologies for my words....
could you please advise how to check if expect is installed in system or not ..
thanks....
Not really, since you don't tell us what version/distro of Linux you're using. You can TRY to type in "expect -version", but if it's not in your path, it won't work. Look in your package management utility to see if its there. And again, even if it IS installed, unless you post your script, there's little we can help with.
Again, WHAT YOU ARE DOING IS A BAD IDEA, and there is NO reason to do it. Use SSH with a keyswap, keep things secure and easy to use.
thank you for helping me here..my script is already ready with the ssh keys but my client insisted to use password based connection
he is not accepting with ssh keys .
Your story keeps changing here. First it was because your system and host might change, now it's your 'client' doesn't want to do it, then the system isn't accepting keys (??). Which is it? And since your script was already set to use passwordless connections, it seems VERY odd that you did that...knowing that your client didn't want to use it/the port and server may change. Why would you go through that effort for a script you knew you couldn't use?
Quote:
expect -version ==> is giving me error, command not found
and my Linux version is ==> Red Hat Enterprise Linux Server release 6.2 (Santiago)
And again, UNLESS YOU HAVE SOFTWARE INSTALLED, YOU CAN'T USE IT. How do you think an expect script is going to work, when you haven't installed expect???
Quote:
Script#
#!/usr/bin/expect
set user user
set pass pass
set host host
Error#
line 7 and 8
expect and send command not found
Right...because you don't have expect installed, and you haven't bothered to read the samples I sent you in post #2. There are errors in your script. Why didn't you even try to read the samples you were provided?
You need to use the spawn command with sftp, is just ONE of the errors.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.