Here document supports user interaction?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Here document supports user interaction?
# 1  
Old 11-10-2010
Here document supports user interaction?

Hi,
I am trying to ssh into a remote machine and then enter a vserver on the remote machine. I am using here document to carry out these commands on the remote machine. My here document looks like this
Code:
ssh username@remotemachine  << HERE
sudo vserver vservername enter
HERE

however the sudo vserver vservername enter does not wait for user interaction which is to enter a passphrase for sudo. It simply prompts me for password 3 times and exists. Smilie

How do i handle user interaction inside a here document,!

Last edited by Scott; 11-10-2010 at 03:32 PM.. Reason: Code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Running plink with user input interaction from vb.net

Hi there, I am trying to run a .sh file with plink from vb.net. I am now able to run the .sh on vb.net but i have a problem because the .sh script require user input: The .sh is prompting a few question and require user to input y/n to proceed. I am trying... (3 Replies)
Discussion started by: yun
3 Replies

2. Shell Programming and Scripting

User interaction that passes the answer to a variable

Please tell me how to write a bash script that asks the user to enter a word and that passes the entered word to a variable. echo "Type a word and press the Enter key:" myVar=`cat` echo "You entered $myVar" The above code is very awkward, because it requires the user to enter... (2 Replies)
Discussion started by: LessNux
2 Replies

3. Shell Programming and Scripting

Here document inside a here document?

Can we use a here document inside a here document? Something like this ssh user@remotehost << REMOTE sudo vserver vsernamename enter << VSERVER perform actions on vserver. VSERVER REMOTE (6 Replies)
Discussion started by: mnanavati
6 Replies

4. Solaris

Zlogin -C with out user Interaction how to proceed?

Hi Guys, I have one requirement like if we run install.sh file it should have to create a zone and install oracle in that zone with out any user interaction. So the complete code should be automated. Almost 90% of the code I completed but i am having some doubts 1) After the zone creation... (1 Reply)
Discussion started by: vijaysachin
1 Replies

5. Shell Programming and Scripting

textbox and user interaction

I'm wanting to get user interaction...textbox or checkboxes would be great. I want to allow someone to enter data into textbox. (this is the time I want to grab a photo from) Then I want to be able to check the different sizes I want for the image. Say 4 options. Is this possible using the... (0 Replies)
Discussion started by: mainegate
0 Replies

6. Programming

Needed help in a ruby script with user interaction involved!

Hi all, I am struck at this point and needed some help in ruby I wanted to write a script that accepts the no of VNICs the user wants to create and then ask for the name of each Vnic he wants then use these names to create the corresponding Vnics Eg: suppose that there are 2 Vnics to be... (0 Replies)
Discussion started by: wrapster
0 Replies

7. UNIX for Dummies Questions & Answers

booting up but the system was waiting for user interaction at console

Hi all, My ssytem is mounted on a rack and not connected with any console. When I rebooted it remotely, it didn't go thru the bootup process. when I connect my laptop to the system locally and found that it was waiting for user interaction. Do you know how to disable it, so that it will boot... (1 Reply)
Discussion started by: stancwong
1 Replies

8. Shell Programming and Scripting

Can i enter password with out user interaction

Can any body help me to write a scripting program for entering a password at run time with out user interaction. (1 Reply)
Discussion started by: kumar_d
1 Replies

9. UNIX for Dummies Questions & Answers

Want to create new users without using "useradd" command and user Interaction.

Don't want to use useradd command to create a new user I am doing manual addition of accounts. Actually I am writing a script and I am working on RedHat7.1 system. What I am trying to do is run the script and pass all the values of the username password and group as command line parameters. Now... (2 Replies)
Discussion started by: syedifti
2 Replies
Login or Register to Ask a Question
ZSSH(1) 							       ZSSH								   ZSSH(1)

NAME
zssh - interactive file transfer wrapper for ssh SYNOPSIS
zssh [zssh options] [--] [ssh options] ztelnet [zssh options] [--] [telnet options] DESCRIPTION
zssh (Zmodem SSH) is a program for interactively transferring files to a remote machine while using the secure shell ( ssh ). It is intended to be a convenient alternative to scp , allowing to transfer files without having to open another session and re-authenticate one- self. zssh is an interactive wrapper for ssh used to switch the ssh connection between the remote shell and file transfers. This is achieved by using another tty/pty pair between the user and the local ssh process to plug either the user's tty (remote shell mode) or another process (file transfer mode) on the ssh connection. ztelnet behaves similarly to zssh, except telnet is used instead of ssh. It is equivalent to 'zssh -s "telnet -8 -E"' Files are transferred through the zmodem protocol, using the rz and sz commands. zssh behaves as an usual ssh session until the escape sequence is depressed ( default is ^@ which can be produced by pressing C-space, or C-2, or C-` ), which enables file transfer mode. A new prompt is then displayed, and commands can be executed locally to initiate file transfers (among other things). It roughly behaves as a local shell featuring line edition, history and completion (thanks to libreadline), globbing, and escape characters ( " ' and ). The following builtins are handled by zssh itself: ? , cd , disconnect , escape , exit , help , hook , quit , repeat , rz , suspend , sz , version cd <dir> change current directory disconnect disconnect and exit escape [^X] Change escape key to ^X. Without argument, print current escape key exit exit file transfer mode. ^D may also be used for this purpose. help print help and tips ? hook prg [args] Hook program 'prg' on the the pty. Its standard input and output will go through the ssh channel. typing 'sz'/'rz' is in fact equivalent to 'hook sz'/'hook rz' A weird imagination is most useful to gain full advantage of this feature. quit same as exit. repeat repeats cmd forever (^C to interrupt). Useful for example if you use a remote script invoking "sz" and you don't want to be typing "rz" each time... Remember however that several files can be transferred by a single sz/rz pair so this is not usually necessary to use repeat. rz Receive files from the remote machine. runs rz and plugs the process on the ssh connection. running sz on the REMOTE machine is required : 1) run `sz <remote_file> ...' from the remote machine shell 2) press the escape sequence (C-space) to enter file transfer mode 3) run the `rz' builtin suspend suspend zssh (back to the local machine shell) sz <file> ... Send files to the remote machine. runs sz and plugs the process on the ssh connection. There is no need to manually run rz on the remote side. version print version information builtins rz , sz , hook and exit return to shell mode after completion. OPTIONS
-f --force Do not ask user any question -h --help show basic help -s cmd --shell cmd run cmd as remote shell instead of the default "ssh -e none" (zssh) or "telnet -8 -E" (ztelnet) ex: zssh -s "rsh -x" -V --version show version -z ^X --zssh-escape ^X set escape sequence to ^X -- may be used to separate zssh options from ssh ones Other arguments are passed verbatim to ssh/telnet/whatever. ENVIRONMENT
ZSSHESCAPE Setting the ZSSHESCAPE environment variable allows to override the default escape sequence. ZSSHESCAPE should contain only two characters of the form `^X', meaning that ^X is to be the new escape sequence. REQUIREMENTS
the following binaries need to be properly installed for zssh to work : ssh/telnet/... the remote shell to be executed (local machine) sz rz zmodem send and receive programs. Should be both on local and remote machine, and (hopefully) of compatible versions. TIPS
If file transfer is initiated but never completes ( ie a line like : Bytes Sent: 38144/4610624 BPS:3424 ETA 22:15 or Bytes Sent: 0/ 513 BPS:0 ETA 00:00 Retry 0: Got ZCAN can be seen, but transfer never completes ) Chances are the pty/tty on one of the systems are not 8-bit clean. (Linux is 8-bit clean, NetBSD is not). Using the -e (escape) option of rz should solve this problem. Transfers can be interrupted with ^C (somewhat experimental =) If you get stuck in rz/sz (for example you've just ran rz, but you then decided not to transmit anything), hit a dozen ^X (Ctrl-X, not the zssh escape!) to stop it Use `sz -y <files>' to overwrite files on the other side BUGS
/ LIMITATIONS You may sometimes have to hit return 2 or 3 times after file transfer completion in order get back to the shell. Some digits are usually displayed; don't worry it won't harm (you or your term) ... the tty may (sometimes) be somewhat upset after an interrupted transfer ( using ^C ). typing `reset' in this case should help. no pipe, redirection (and other stuff) support in shell ... but after all there are already wonderful shells around =) CREDITS
ttssh's author - Robert O'Callahan - for the original idea The sourceforge team. AUTHOR
Matthieu Lucotte <gounter@users.sourceforge.net> zssh homepage: http://zssh.sourceforge.net SEE ALSO
ssh(1), telnet(1), scp(1), sz(1), rz(1), readline(3), ZSSH
June 26, 2000 ZSSH(1)