From: pavunkumar on 19 Feb 2010 02:36 Is there any way to give the password through variables. For example we are executing scp, ssh , passwd command , Normally it will ask password in that prompt. I wanted to give value for that by assigning some variable values. For example: [$home] ssh abubacker(a)192.168.8.20 abubacker(a)192.168.8.20's password: Instead of prompting , it needs to get the password from some variable.
From: Barry Margolin on 19 Feb 2010 03:49 In article <c4bbf2b1-36c2-4e4c-8cda-4aedda4aae2a(a)m27g2000prl.googlegroups.com>, pavunkumar <pavun.bks(a)gmail.com> wrote: > Is there any way to give the password through variables. > > For example we are executing scp, ssh , passwd command , Normally it > will ask password in that prompt. I wanted to give value for that by > assigning some variable values. > > For example: > > [$home] ssh abubacker(a)192.168.8.20 > abubacker(a)192.168.8.20's password: > > Instead of prompting , it needs to get the password from some > variable. You'd need to use an Expect script. But better would be to use public/private keys and ssh-agent. -- Barry Margolin, barmar(a)alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***
From: mop2 on 19 Feb 2010 04:35 On Fri, 19 Feb 2010 05:36:34 -0200, pavunkumar <pavun.bks(a)gmail.com> wrote: > > Is there any way to give the password through variables. > > For example we are executing scp, ssh , passwd command , Normally > it > will ask password in that prompt. I wanted to give value for that > by > assigning some variable values. > > For example: > > [$home] ssh abubacker(a)192.168.8.20 > abubacker(a)192.168.8.20's password: > > Instead of prompting , it needs to get the password from some > variable. > search for sshpass in: groups.google.com/group/comp.unix.shell/topics?gvc=2
From: pavunkumar on 19 Feb 2010 07:09 On Feb 19, 2:35 pm, mop2 <inva...(a)mail.address> wrote: > On Fri, 19 Feb 2010 05:36:34 -0200, pavunkumar <pavun....(a)gmail.com> > wrote: > > > > > > > Is there any way to give the password through variables. > > > For example we are executing scp, ssh , passwd command , Normally > > it > > will ask password in that prompt. I wanted to give value for that > > by > > assigning some variable values. > > > For example: > > > [$home] ssh abubac...(a)192.168.8.20 > > abubac...(a)192.168.8.20's password: > > > Instead of prompting , it needs to get the password from some > > variable. > > search for > sshpass > in: > groups.google.com/group/comp.unix.shell/topics?gvc=2 Question is very simple , I have script for executing passwd command passwd.sh #!/bin/sh mypass='twinkle' ; # Assume that my password is twinkle . Now I want to assign passwd command . passwd Like that I wanted do . So , will not prompt the user in terminal
From: Kenny McCormack on 19 Feb 2010 10:03 In article <3fb598ba-a96e-4e65-a603-6a077bdeca79(a)c34g2000pri.googlegroups.com>, pavunkumar <pavun.it(a)gmail.com> wrote: .... >Question is very simple , I have script for executing passwd >command > >passwd.sh > >#!/bin/sh > >mypass='twinkle' ; ># Assume that my password is twinkle . Now I want to assign passwd >command . >passwd > >Like that I wanted do . So , will not prompt the user in terminal Barry's answer was correct, although expressed in usual Usenet/Unix-man-page style (I.e., unless you already know the answer, the answer won't make any sense to you). Anyway, what it boils down to is this: 1) In theory, you should be able to do this with ordinary I/O "redirection", but programs that prompt for a password often explicitly refuse to work with redirection, as a "safety/security" feature. Note that some GNU programs have extensions that allow you to force the program to read from standard input, but this is "swimming against the stream/making the program do something it doesn't want to do". 2) You can use the "Expect" program to get around the limitation described above. Expect is a really cool program that everyone should learn and use, but, as indicated next, it isn't really necessary here, and the better solution is: 3) The SSH program suite supports "public key encryption", which is a magical way of getting around this problem. If you can use it, you should.
|
Next
|
Last
Pages: 1 2 Prev: for i in [Dd][Oo]*.pdf Next: copy a filesystem and preserve hard links on Linux |