This content has been marked as final. Show 7 replies
I have not used "expect" for scripting my stuff yet, but apparently you can turn off the screen output:
You can still capture the output, but you won't see it on screen. To turn it back to normal:
To read more about it, check http://expect.sourceforge.net/FAQ.html. No. 51.
May be it's more easy and secure use ssh key-authorization ?
On your host you genarate keys:
ssh-keygen -t rsa
Press anter on all questions.
It's generate public-key: $HOME/.ssh/id_rsa.pub
Add content of this file on required host to $HOME/.ssh/authorized_keys
After this you can do ssh <user>@host without password request.
I have no idea what the OP is actually trying to accomplish, but user equivalence and a password less login might generally be a good idea for security. However, the OP asked about changing the password on remote systems apparently for interactive login.1 person found this helpful
I generally use the following to setup user equivalence:
On the local system:
mkdir -p ~/.ssh
chmod 700 ~/.ssh
rm -f ~/.ssh/id_dsa
ssh-keygen -t dsa -N "" -f ~/.ssh/id_dsa
ssh username@remotehost "mkdir -p .ssh; chmod 700 .ssh"
ssh username@remotehost "echo "$KEY" >> .ssh/authorized_keys"
ssh username@remotehost "chmod 644 .ssh/authorized_keys"
The next login to username@remotehost should no longer prompt for a password.
There is also the "ssh-copy-id utility", which can simply the process, but it is not available on all systems.
By the way, version 1 of the ssh protocol supported only RSA keys. Version 2 of ssh introduced DSA, which is an opensource patent-free implementation.The RSA patent has expired, but as far as I know, cURL and SFTP require DSA.
thank you . log_user 0 worked . but another help require. the requirement got change. I am not sure in "expect" whether it is possible or not.it should work like this :-
Script will ask the user name, once the user enter the user name it will ask the password . once the user put the password it will change the password to all the nodes iin "host" file (not /etc/host).so is there anyway where in expect language i can pass the id & password in variable not in command line argument.If yes then please let me know the code.
If the answer worked I suggest to assign points for helpful answers and mark the thread as answered. Mixing topics and changing the requirements in a thread is not a good idea. It will be better and more useful for anyone else reading your post if you start a new thread, including the content of your new script.
Sure i will / please let me know how i will assign points here. i am new to this forum.
how i will assign points to u pls let me know.