Sponsored Content
Top Forums Shell Programming and Scripting How to make expect to leave control for user? Post 302627715 by urello on Saturday 21st of April 2012 11:39:03 AM
Old 04-21-2012
How to make expect to leave control for user?

Hello. I have several domains which are using different LDAP trees. To make life easier i wrote such script
Code:
!#/bin/bash
case $1 in
 "doman1")
  login='login1'
  password='pass1'
 "doman2")
  login='login2'
  password='pass2'
 "doman3")
  login='login3'
  password='pass3'
/usr/bin/expect -- << EXPECTEND
spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${login}@$1
expect assword: {send "\\$password\r"}
expect \\$$
interact
EXPECTEND

It is not working. I need to stay on target host, but after first command i appear on source host.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

User control passing parameter

there is a example: sh shell name () { echo $1 echo $2 echo $3 } echo "Enter value:" read a b c d name $a $b here permit user enter 1-4 value to the variables respectively, question is : no restrict for user input...? using only 1 variable to... (3 Replies)
Discussion started by: trynew
3 Replies

2. UNIX for Advanced & Expert Users

control user password

I have two unix server ( eg. they are Server A , Server B ) and want to use LDAP to control the user profile , each of these servers have some database and application are running , assume I have setup Server A as LDAP server . Now I am not too understand the practice of it, could anyone can advise... (0 Replies)
Discussion started by: ust
0 Replies

3. Shell Programming and Scripting

Expect control statement

I am using expect I dont know tcl but trying to use a control statement to send requests from an input file - dont know what I am doing to be honest as I dont know tcl and dont use expect too much... Any help? See below Basically I am opening a telnet session to a server which works fine... (2 Replies)
Discussion started by: frustrated1
2 Replies

4. Linux

Modify expect script with control statement

Ok, so I have this script that was provided to me by one of the posters on this site. This script seems to be perfect. However, since this is a telnet script, i need to add an if then statement to it but dont know how to do it. What i want to do is to have this script spit out a certain... (3 Replies)
Discussion started by: SkySmart
3 Replies

5. Shell Programming and Scripting

Switch to different user without expect

Hi, I have to switch to a different user and execute certain commands and then come back to the original user Ex: My id is 'usstage'. I need to switch to 'apstage', souce a script there, execute a function and then get back again to usstage. Please note that I do not have expect installed... (4 Replies)
Discussion started by: sugan
4 Replies

6. UNIX for Dummies Questions & Answers

user control- supplementary group

What is a supplementary group and how do you make a supplementary group for members of a team? Thanks in advance. ---------- Post updated 05-10-11 at 12:09 PM ---------- Previous update was 05-09-11 at 10:08 PM ---------- anybody? (1 Reply)
Discussion started by: nlassiter
1 Replies

7. Shell Programming and Scripting

I need to make a control panel for a Linux script

has anyone got experience using jsch? Does it give me a prompt when I run a command/ print result back to me. I need to send commands to a linux database like restart,shutdown,stop database caching etc. But in java I want to build a GUI I can use. TO call database commands. and do these... (3 Replies)
Discussion started by: Samuel12
3 Replies

8. Shell Programming and Scripting

EXPECT Bash Script Error Control

Hello Geeks once more, Thanks for all the help you have been rendering.. I have a script that depends on the output of an expect statement but sometimes the main script misbehaves which I believe is a result of SSH communication error, how can I apply an error control to know whether the... (2 Replies)
Discussion started by: infinitydon
2 Replies

9. Shell Programming and Scripting

Make expect exit the UNIX script in erreneous condition

Hi, I am writing a menu driven program using shell script. THe script will be collecting data by logging into the other servers and bringing back the data to home server to process it and accordingly issue commands. TO automate commands execution , I am using expect script. However I am not able... (5 Replies)
Discussion started by: ashima jain
5 Replies

10. UNIX for Advanced & Expert Users

Pam.d and make difference between AD User and local user on Linux

Hello, i configured rhel linux 6 with AD directory to authorize windows users to connect on the system and it works. i have accounts with high privileges (oracle for example) if an account is created on the AD server i would to block him. I looked for how to do, for the moment all the... (3 Replies)
Discussion started by: vincenzo
3 Replies
LOGIN(8)						      System Manager's Manual							  LOGIN(8)

NAME
login.krb5 - kerberos enhanced login program SYNOPSIS
login.krb5 [-p] [-fFe username] [-r | -k | -K | -h hostname] DESCRIPTION
login.krb5 is a modification of the BSD login program which is used for two functions. It is the sub-process used by krlogind and telnetd to initiate a user session and it is a replacement for the command-line login program which, when invoked with a password, acquires Ker- beros tickets for the user. login.krb5 will prompt for a username, or take one on the command line, as login.krb5 username and will then prompt for a password. This password will be used to acquire Kerberos Version 5 tickets (if possible.) It will also attempt to run aklog to get AFS tokens for the user. The version 5 tickets will be tested against a local krb5.keytab if it is available, in order to verify the tickets, before letting the user in. However, if the password matches the entry in /etc/passwd the user will be unconditionally allowed (permitting use of the machine in case of network failure.) OPTIONS
-p preserve the current environment -r hostname pass hostname to rlogind. Must be the last argument. -h hostname pass hostname to telnetd, etc. Must be the last argument. -f name Perform pre-authenticated login, e.g., datakit, xterm, etc.; allows preauthenticated login as root. -F name Perform pre-authenticated login, e.g., datakit, xterm, etc.; allows preauthenticated login as root. -e name Perform pre-authenticated, encrypted login. Must do term negotiation. CONFIGURATION
login.krb5 is also configured via krb5.conf using the login stanza. A collection of options dealing with initial authentication are pro- vided: krb5_get_tickets Use password to get V5 tickets. Default value true. krb_run_aklog Attempt to run aklog. Default value false. aklog_path Where to find it [not yet implemented.] Default value $(prefix)/bin/aklog. accept_passwd Don't accept plaintext passwords [not yet implemented]. Default value false. DIAGNOSTICS
All diagnostic messages are returned on the connection or tty associated with stderr. SEE ALSO
rlogind(8), rlogin(1), telnetd(8) LOGIN(8)
All times are GMT -4. The time now is 05:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy