* keyboard macro to record scp (password)
@ 2011-07-11 11:00 C K Kashyap
2011-07-11 11:29 ` Michael Albinus
` (2 more replies)
0 siblings, 3 replies; 22+ messages in thread
From: C K Kashyap @ 2011-07-11 11:00 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 323 bytes --]
Hi,
I need to do scp multiple times (and in this case, authorized_keys thingy is
not an option). I tried to record a keyboard macro to record the scp action
- including the password entry - but that does not seem to work. The
password gets typed even before the its prompted for. How do I get around
this?
Regards,
Kashyap
[-- Attachment #2: Type: text/html, Size: 356 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 11:00 keyboard macro to record scp (password) C K Kashyap
@ 2011-07-11 11:29 ` Michael Albinus
2011-07-11 11:34 ` suvayu ali
2011-07-11 12:24 ` Perry Smith
2 siblings, 0 replies; 22+ messages in thread
From: Michael Albinus @ 2011-07-11 11:29 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
C K Kashyap <ckkashyap@gmail.com> writes:
> Hi,
>
> I need to do scp multiple times (and in this case, authorized_keys
> thingy is not an option). I tried to record a keyboard macro to record
> the scp action - including the password entry - but that does not seem
> to work. The password gets typed even before the its prompted for. How
> do I get around this?
Do you need it with Tramp? In this case, setting `password-cache-expiry'
to nil might be an option.
> Regards,
> Kashyap
Best regards, Michael.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 11:00 keyboard macro to record scp (password) C K Kashyap
2011-07-11 11:29 ` Michael Albinus
@ 2011-07-11 11:34 ` suvayu ali
2011-07-11 12:24 ` Perry Smith
2 siblings, 0 replies; 22+ messages in thread
From: suvayu ali @ 2011-07-11 11:34 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
On Mon, Jul 11, 2011 at 1:00 PM, C K Kashyap <ckkashyap@gmail.com> wrote:
> Hi,
> I need to do scp multiple times (and in this case, authorized_keys thingy is
> not an option). I tried to record a keyboard macro to record the scp action
> - including the password entry - but that does not seem to work. The
> password gets typed even before the its prompted for. How do I get around
> this?
You can try these options:
1. Solve it outside emacs with ssh-agent
2. Assuming you are using tramp, you could try ssh instead of scp. ssh
keeps the connection open so you do not need to retype the password.
However if there is a session expiry policy on the remote end, that
cannot be circumvented.
> Regards,
> Kashyap
Hope this helps.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 11:00 keyboard macro to record scp (password) C K Kashyap
2011-07-11 11:29 ` Michael Albinus
2011-07-11 11:34 ` suvayu ali
@ 2011-07-11 12:24 ` Perry Smith
2011-07-11 13:09 ` C K Kashyap
2 siblings, 1 reply; 22+ messages in thread
From: Perry Smith @ 2011-07-11 12:24 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
On Jul 11, 2011, at 6:00 AM, C K Kashyap wrote:
> Hi,
> I need to do scp multiple times (and in this case, authorized_keys thingy is not an option). I tried to record a keyboard macro to record the scp action - including the password entry - but that does not seem to work. The password gets typed even before the its prompted for. How do I get around this?
A few others have replied along the ssh / tramp lines. As far as the password, sometimes you can do sit-for to get simple interactions to work.
I'm also not clear what "scp multiple times" means. Are you going to intermediate hosts? e.g. A => B and then B => C ?
pedz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 12:24 ` Perry Smith
@ 2011-07-11 13:09 ` C K Kashyap
2011-07-11 13:52 ` Michael Albinus
0 siblings, 1 reply; 22+ messages in thread
From: C K Kashyap @ 2011-07-11 13:09 UTC (permalink / raw)
To: Perry Smith; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 703 bytes --]
Thanks folks,
Here are a couple of clarification points -
1. I am not using tramp
2. The usecase is as follows - I need to ssh into a server where I
manipulate a file and then I have to scp the file into a local machine that
requires me to enter password. I need to repeat this a number of times - but
each time, its the same file so, essentially I just have to re-execute the
same scp command - scp file localmachine:/path .... I'd like to record the
copying action into a keyboard macro that I can playback.
I'd like to be able to solve it with just emacs - I mean, this situation is
really common for me so it would be great if I could get a plain vanilla
emacs solution to this.
Regards,
Kashyap
[-- Attachment #2: Type: text/html, Size: 826 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 13:09 ` C K Kashyap
@ 2011-07-11 13:52 ` Michael Albinus
2011-07-11 14:02 ` C K Kashyap
0 siblings, 1 reply; 22+ messages in thread
From: Michael Albinus @ 2011-07-11 13:52 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
C K Kashyap <ckkashyap@gmail.com> writes:
> I'd like to be able to solve it with just emacs - I mean, this
> situation is really common for me so it would be great if I could get
> a plain vanilla emacs solution to this.
Tramp.
> Regards,
> Kashyap
Best regards, Michael.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 13:52 ` Michael Albinus
@ 2011-07-11 14:02 ` C K Kashyap
2011-07-11 14:20 ` Michael Albinus
2011-07-11 14:53 ` Deniz Dogan
0 siblings, 2 replies; 22+ messages in thread
From: C K Kashyap @ 2011-07-11 14:02 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 73 bytes --]
>
>
> Tramp.
>
>
> Alright ... I'll check out the Tramp manual :) Thanks
[-- Attachment #2: Type: text/html, Size: 384 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 14:02 ` C K Kashyap
@ 2011-07-11 14:20 ` Michael Albinus
2011-07-11 14:53 ` Deniz Dogan
1 sibling, 0 replies; 22+ messages in thread
From: Michael Albinus @ 2011-07-11 14:20 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
C K Kashyap <ckkashyap@gmail.com> writes:
> Alright ... I'll check out the Tramp manual :) Thanks
Feel free to ask, if you run into problems. Given, that I have pushed
you this way ...
Best regards, Michael.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 14:02 ` C K Kashyap
2011-07-11 14:20 ` Michael Albinus
@ 2011-07-11 14:53 ` Deniz Dogan
2011-07-11 18:06 ` suvayu ali
1 sibling, 1 reply; 22+ messages in thread
From: Deniz Dogan @ 2011-07-11 14:53 UTC (permalink / raw)
To: help-gnu-emacs
On 2011-07-11 16:02, C K Kashyap wrote:
>
> Tramp.
>
>
> Alright ... I'll check out the Tramp manual :) Thanks
It's really just as simple as doing:
C-x C-f /user@remotehost:somefile.txt
It's all seamless. Enjoy!
Deniz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 14:53 ` Deniz Dogan
@ 2011-07-11 18:06 ` suvayu ali
2011-07-12 5:19 ` C K Kashyap
0 siblings, 1 reply; 22+ messages in thread
From: suvayu ali @ 2011-07-11 18:06 UTC (permalink / raw)
To: Deniz Dogan; +Cc: help-gnu-emacs
On Mon, Jul 11, 2011 at 4:53 PM, Deniz Dogan <deniz@dogan.se> wrote:
> On 2011-07-11 16:02, C K Kashyap wrote:
>>
>> Tramp.
>>
>>
>> Alright ... I'll check out the Tramp manual :) Thanks
>
> It's really just as simple as doing:
>
> C-x C-f /user@remotehost:somefile.txt
>
> It's all seamless. Enjoy!
>
Maybe a /ssh:user@remotehost:somefile.txt just to specify ssh explicitly or set
(setq tramp-default-method "ssh")
> Deniz
>
>
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-11 18:06 ` suvayu ali
@ 2011-07-12 5:19 ` C K Kashyap
2011-07-12 6:14 ` Peter Münster
` (2 more replies)
0 siblings, 3 replies; 22+ messages in thread
From: C K Kashyap @ 2011-07-12 5:19 UTC (permalink / raw)
To: suvayu ali; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
I tried Tramp and its really cool. I am certainly going to use it for
editing remote files. A quick question .... looks like it was automatically
able to cache the password for subsequent C-x C-f - however, it prompts for
password for each M-x shell
My original usecase however is to be able to "cache" passwords in eshell -
perhaps, I need to modify the keyboard macro recording to wait for a bit
(till the password is prompted for) before re-playing the password.
Regards,
Kashyap
[-- Attachment #2: Type: text/html, Size: 621 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 5:19 ` C K Kashyap
@ 2011-07-12 6:14 ` Peter Münster
2011-07-12 10:11 ` C K Kashyap
2011-07-12 6:23 ` Suvayu Ali
2011-07-12 7:19 ` Michael Albinus
2 siblings, 1 reply; 22+ messages in thread
From: Peter Münster @ 2011-07-12 6:14 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, Jul 12 2011, C K Kashyap wrote:
> My original usecase however is to be able to "cache" passwords in eshell -
> perhaps, I need to modify the keyboard macro recording to wait for a bit (till
> the password is prompted for) before re-playing the password.
3 ideas:
- expect (password saved somewhere)
- public key authentication
- (sleep-for 1) in macro
--
Peter
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 5:19 ` C K Kashyap
2011-07-12 6:14 ` Peter Münster
@ 2011-07-12 6:23 ` Suvayu Ali
2011-07-12 6:29 ` C K Kashyap
2011-07-12 7:19 ` Michael Albinus
2 siblings, 1 reply; 22+ messages in thread
From: Suvayu Ali @ 2011-07-12 6:23 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
On Tue, 12 Jul 2011 10:49:02 +0530
C K Kashyap <ckkashyap@gmail.com> wrote:
> My original usecase however is to be able to "cache" passwords in
> eshell - perhaps, I need to modify the keyboard macro recording to
> wait for a bit (till the password is prompted for) before re-playing
> the password.
The whole point of tramp was so that you don't need to scp the file
over and over again. You can now edit the file remotely, no need for
an eshell anymore (except for other commands you need to run on the
remote machine). Or did I misunderstand your use case?
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 6:23 ` Suvayu Ali
@ 2011-07-12 6:29 ` C K Kashyap
2011-07-12 6:40 ` Suvayu Ali
2011-07-12 7:22 ` Michael Albinus
0 siblings, 2 replies; 22+ messages in thread
From: C K Kashyap @ 2011-07-12 6:29 UTC (permalink / raw)
To: Suvayu Ali; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
>
>
> The whole point of tramp was so that you don't need to scp the file
> over and over again. You can now edit the file remotely, no need for
> an eshell anymore (except for other commands you need to run on the
> remote machine). Or did I misunderstand your use case?
>
>
> The file in question is not something I'd like to edit .... it's a zip file
that I need to copy over.
[-- Attachment #2: Type: text/html, Size: 635 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 6:29 ` C K Kashyap
@ 2011-07-12 6:40 ` Suvayu Ali
2011-07-12 7:07 ` C K Kashyap
2011-07-12 7:22 ` Michael Albinus
1 sibling, 1 reply; 22+ messages in thread
From: Suvayu Ali @ 2011-07-12 6:40 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
On Tue, 12 Jul 2011 11:59:35 +0530
C K Kashyap <ckkashyap@gmail.com> wrote:
> The file in question is not something I'd like to edit .... it's a
> zip file that I need to copy over.
Then I am afraid I don't know how to do this from emacs. According to
my understanding this has to be solved on the ssh side.
Also if what you are editing is inside the zip file, then you can still
edit it with emacs. Just open it like a regular text file, emacs will
list all its contents which you can then edit.
I hope this helps.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 6:40 ` Suvayu Ali
@ 2011-07-12 7:07 ` C K Kashyap
2011-07-12 8:47 ` Suvayu Ali
0 siblings, 1 reply; 22+ messages in thread
From: C K Kashyap @ 2011-07-12 7:07 UTC (permalink / raw)
To: Suvayu Ali; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 642 bytes --]
>
>
> Then I am afraid I don't know how to do this from emacs. According to
> my understanding this has to be solved on the ssh side.
>
> Also if what you are editing is inside the zip file, then you can still
> edit it with emacs. Just open it like a regular text file, emacs will
> list all its contents which you can then edit.
>
> I hope this helps.
>
>
> Let me generalize this a bit - I'd like to automate interactive command
line apps. Is there a generic solution in emacs for this.
I've never got expect to work - but I guess that's the kind of solution I am
looking for. An arbitrary sleep is a little to fragile.
Regards,
Kashyap
[-- Attachment #2: Type: text/html, Size: 1002 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 5:19 ` C K Kashyap
2011-07-12 6:14 ` Peter Münster
2011-07-12 6:23 ` Suvayu Ali
@ 2011-07-12 7:19 ` Michael Albinus
2 siblings, 0 replies; 22+ messages in thread
From: Michael Albinus @ 2011-07-12 7:19 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
C K Kashyap <ckkashyap@gmail.com> writes:
> I tried Tramp and its really cool. I am certainly going to use it for
> editing remote files. A quick question .... looks like it was
> automatically able to cache the password for subsequent C-x C-f -
> however, it prompts for password for each M-x shell
Tramp uses password-cache.el. Check variable password-cache-expiry. Its
default value is 16 (passwords expire after 16 seconds). If you change
this value to t, passwords do not expire during the lifetime of your
Emacs session.
They won't be stored in a file, just kept in memory.
> My original usecase however is to be able to "cache" passwords in
> eshell - perhaps, I need to modify the keyboard macro recording to
> wait for a bit (till the password is prompted for) before re-playing
> the password.
Tramp is also compatible with eshell. See the Tramp manual for use cases.
> Regards,
> Kashyap
Best regards, Michael.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 6:29 ` C K Kashyap
2011-07-12 6:40 ` Suvayu Ali
@ 2011-07-12 7:22 ` Michael Albinus
1 sibling, 0 replies; 22+ messages in thread
From: Michael Albinus @ 2011-07-12 7:22 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
C K Kashyap <ckkashyap@gmail.com> writes:
> The file in question is not something I'd like to edit .... it's a zip
> file that I need to copy over.
Just in case you want to check something in that file: "C-x C-f
/user@host:/path/to/file.zip" shall work out of the box.
Best regards, Michael.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 7:07 ` C K Kashyap
@ 2011-07-12 8:47 ` Suvayu Ali
0 siblings, 0 replies; 22+ messages in thread
From: Suvayu Ali @ 2011-07-12 8:47 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
On Tue, 12 Jul 2011 12:37:05 +0530
C K Kashyap <ckkashyap@gmail.com> wrote:
> Let me generalize this a bit - I'd like to automate interactive
> command line apps. Is there a generic solution in emacs for this.
I think you are looking for a solution in the wrong place. You want a
solution for terminal utilities, this is best achieved using facilities
present in the terminal.
You have a number of options:
1. public key authentication
2. ssh-agent (which is probably related with public keys, haven't used
myself so not sure about the details)
3. sshfs network mounts with fuse
4. NFS mounts
Apart from this, on the Emacs side you could try:
1. you could try what Michael suggested about pasword-cache
2. dired over tramp might work
However I think the main problem might be your development methodology.
It seems to me it could be better adapted so that you don't need to scp
so many times. If you are having to do that, then that is probably not
the optimum solution. If you could outline what you are doing step by
step, maybe someone here could suggest alternate ways of achieving the
same goal.
GL
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 6:14 ` Peter Münster
@ 2011-07-12 10:11 ` C K Kashyap
2011-07-12 10:50 ` C K Kashyap
0 siblings, 1 reply; 22+ messages in thread
From: C K Kashyap @ 2011-07-12 10:11 UTC (permalink / raw)
To: Peter Münster; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 458 bytes --]
>
> 3 ideas:
> - expect (password saved somewhere)
> - public key authentication
> - (sleep-for 1) in macro
>
> --
>
Hi Peter,
I tried the (sleep-for 3) idea - there seems to be a problem though - for
some reason, when I playback the macro, the sleep happens first and then the
whole thing gets typed.
What I did was, record the macro and then edit it and insert the M-:
(sleep-for 3)C-j right after the return key after the ssh command.
regards,
Kashyap
[-- Attachment #2: Type: text/html, Size: 716 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 10:11 ` C K Kashyap
@ 2011-07-12 10:50 ` C K Kashyap
2011-07-12 12:49 ` Peter Münster
0 siblings, 1 reply; 22+ messages in thread
From: C K Kashyap @ 2011-07-12 10:50 UTC (permalink / raw)
To: Peter Münster; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
>
>
> Hi Peter,
> I tried the (sleep-for 3) idea - there seems to be a problem though - for
> some reason, when I playback the macro, the sleep happens first and then the
> whole thing gets typed.
>
> What I did was, record the macro and then edit it and insert the M-:
> (sleep-for 3)C-j right after the return key after the ssh command.
>
>
>
(defun fun (n) (progn
(insert "ssh machinename")
(sleep-for 2)
(insert "password")
)
)
the above function illustrates my point. When I execute this function, the
sleep happens first and then the complete inserts.
Regards,
Kashyap
[-- Attachment #2: Type: text/html, Size: 1322 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: keyboard macro to record scp (password)
2011-07-12 10:50 ` C K Kashyap
@ 2011-07-12 12:49 ` Peter Münster
0 siblings, 0 replies; 22+ messages in thread
From: Peter Münster @ 2011-07-12 12:49 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, Jul 12 2011, C K Kashyap wrote:
> (defun fun (n) (progn
> (insert "ssh machinename")
> (sleep-for 2)
> (insert "password")
> )
> )
>
> the above function illustrates my point. When I execute this function, the
> sleep happens first and then the complete inserts.
IMH emacs is not the right tool for this task. (sleep-for) was just an
idea, I don't use shell in emacs.
Here some tool suggestions for different tasks:
task tool
programmed dialogue
with interactive programs expect
password-less scp public-key auth. / ssh-agent
accessing remote files sshfs, tramp, nfs, etc.
--
Peter
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2011-07-12 12:49 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-11 11:00 keyboard macro to record scp (password) C K Kashyap
2011-07-11 11:29 ` Michael Albinus
2011-07-11 11:34 ` suvayu ali
2011-07-11 12:24 ` Perry Smith
2011-07-11 13:09 ` C K Kashyap
2011-07-11 13:52 ` Michael Albinus
2011-07-11 14:02 ` C K Kashyap
2011-07-11 14:20 ` Michael Albinus
2011-07-11 14:53 ` Deniz Dogan
2011-07-11 18:06 ` suvayu ali
2011-07-12 5:19 ` C K Kashyap
2011-07-12 6:14 ` Peter Münster
2011-07-12 10:11 ` C K Kashyap
2011-07-12 10:50 ` C K Kashyap
2011-07-12 12:49 ` Peter Münster
2011-07-12 6:23 ` Suvayu Ali
2011-07-12 6:29 ` C K Kashyap
2011-07-12 6:40 ` Suvayu Ali
2011-07-12 7:07 ` C K Kashyap
2011-07-12 8:47 ` Suvayu Ali
2011-07-12 7:22 ` Michael Albinus
2011-07-12 7:19 ` Michael Albinus
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.