Forcing a tty session but getting a password prompt?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Forcing a tty session but getting a password prompt?
# 1  
Old 11-16-2011
Network Forcing a tty session but getting a password prompt?

I have a master host I want to use to issue some start/stop of LDAP services.

I changed the client hosts /etc/sudoers to have
Defaults:infra !requiretty

The master host kicks off the jobs using the infra account doing a ssh session to the infra account on the clients.

Code:
#!/bin/ksh
ps -fu infra
/sbin/service ldap_dscc stop
sleep 10
ps -fu infra

Master host calls,
ssh -q -tt <hostname> "sh ldap.stop"

Code:
== Result ==
UID        PID  PPID  C STIME TTY          TIME CMD
infra    32568 32566  0 19:45 ?        00:00:00 sshd: infra@pts/0
infra    32569 32568  0 19:45 pts/0    00:00:00 sh ldap.stop
infra    32570 32569  0 19:45 pts/0    00:00:00 ps -fu infra
Stopping DSCC ldap instance ...
Password:

I can't figure out why I'm getting this password prompt on the stop command. Is it a limitation of trying to stop services via ssh?

Would putting "nohup &" around the stop call help get past the password hangup?
nohup /sbin/service ldap_dscc stop &
# 2  
Old 11-16-2011
Are you able to stop the ldap services logging into the server with same user? Also, after running the ldap.stop script, did the service stop? (yeah I know the script has hung, but the see the message "Stopping ldap instance...")

--ahamed
# 3  
Old 11-16-2011
Is the password being generated by ssh maybe? Do you have a public key in the authorized_hosts file on the remote machine. What is the result of
Code:
ssh -q -tt <hostname> date

You might have determined that it's not ssh, but since you didn't mention it I figured I'd ask.
# 4  
Old 11-16-2011
The user has pasted the output of ps command(which is the first command from the script), so I thought the password prompt may not be from ssh.

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 5  
Old 11-16-2011
Oops, I see that now! -- it's late and I guess Im more tired than I thought. Time to stop trying to focus on the screen. Thanks.
# 6  
Old 11-17-2011
Found the issue, the guy who wrote the /etc/init.d/ldap_dscc assumed root would run the stop and put su - infra all over the script.

Got them to add
Code:
NOT_INFRA="su - infra -c "
if [[ "$(whoami)" == "infra" ]]; then
    NOT_INFRA=""
fi
${NOT_INFRA}"/apps/infra/directory/client/11g/dsee7/bin/dsadm start /apps/infra/directory/client/11g/dsee7/var/dcc/ads"

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reading password from /dev/tty

hi, From the below script: ##########################################pwd_auth.sh######################################################################################## #Author: Pandeeswaran Bhoopathy #Written on:26th Jan 2012 2:00PM #This script describes the feature of stty and illustrates... (3 Replies)
Discussion started by: pandeesh
3 Replies

2. Solaris

How to prompt for the new password during the first login

Hi All, I have created a new user. Using the below command I have created the user successfully. useradd -c "Test user" -d /tmp/test -g Testgroup -s /bin/ksh -u 601 Test I don't want to set the password using “passwd” command after creating a user. I want to prompt for the new... (2 Replies)
Discussion started by: kalpeer
2 Replies

3. Solaris

Can we spy a tty session?

First of all, in no way I want to use this to hack / cheat / steal etc ... I am an admin of a couple of hundred users which are 99,8% > 500miles away from me and to facilitate some administration part I would like to be able to "spy" what they are doing in there sessions, live. ex: ... (7 Replies)
Discussion started by: plmachiavel
7 Replies

4. AIX

Session never expired If i closed client prompt

Hi, I need a solution. I am using Putty/CRT to login in a AIX server from my windows machine. When i closed my putty/CRT prompt from windows client, server session is expire. Ex. I have run a script to take RMAN backup from PUTTY/CRT command window, After closing command window RMAN backup... (2 Replies)
Discussion started by: dearsumon
2 Replies

5. Shell Programming and Scripting

Not able to pass Username and Password in telnet session

I have created a shell script to telnet remote machine. Here is the problem I am not able to pass the login username and password to the telnet session. I have searched forum and got few other methods to achieve this. But I need to know what's wrong in the below script. username="root"... (2 Replies)
Discussion started by: uxpassion
2 Replies

6. Solaris

PAM, Solaris, Openssh and Forcing a password change

Here's the issue. Currently when I run passwd -f "username" on any account, when I try to login with said account I don't get prompted to change my password I just keep getting prompted to input a password. (Of course this works just fine with telnet)Is there something i need to add to... (7 Replies)
Discussion started by: woodson2
7 Replies

7. Shell Programming and Scripting

automating ssh session with password

Hi Can anyone help me in automate a ssh session with password using shell script (7 Replies)
Discussion started by: raghav288
7 Replies

8. Solaris

forcing password change every X days?

Hi, how do I go about forcing users to change their password every, say, 30 days? Aaron (1 Reply)
Discussion started by: amheck
1 Replies

9. UNIX for Advanced & Expert Users

Unix login session and Password

Hi All, I've login to Unix using login name guest and I'm working on it, I need another session to run some script hence tried to login but password invalid it says here my question is : Since I'm in working in one session can I set the password without knowing old password? is there any... (1 Reply)
Discussion started by: krishna
1 Replies
Login or Register to Ask a Question