Script as login shell (passing args to login shell)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script as login shell (passing args to login shell)
# 15  
Old 03-31-2014
That's how my scheme works too. The php page writes into the connection, the script reads it, and it gets the variables that way.
This User Gave Thanks to Corona688 For This Post:
# 16  
Old 03-31-2014
So how do you parse the data at the other end? The receiving part is my problem since i get 2 args (-c and a block of "-i 0.0.0.0 -n host1 ).

Should i drop the options since only the php code will trigger that script so no sense in keeping those?

Then i can put the block of args split it into an array and check check more check and then use the values?
# 17  
Old 03-31-2014
Quote:
Originally Posted by maverick72
So how do you parse the data at the other end?
As I explained, I don't use args. I write it into the script's standard input.
This User Gave Thanks to Corona688 For This Post:
# 18  
Old 04-01-2014
Ohhhhhh f... me .... i'll take a look again tomorrow morning Smilie Not sure if i'll be able to make it work the first time but i'll do my best Smilie

Thanks alot for your help. I'll keep ya posted.

---------- Post updated 04-01-14 at 12:11 PM ---------- Previous update was 03-31-14 at 09:24 PM ----------

Ok round 2 Smilie

I've looked at your method and mine just want to be sure about the work flow cause i'm still confused.

My method. Or at least what was the original plan:

- User gets to a web page with a form asking for information (ip, host, remove or not).

- He put's all the required info and push send.

- The php code opens up a remote ssh connection (with remote server ip address of server plus credentials).

- That login trigger the login shell which is my bash script. That runs with the desire arguments that comes from the ssh args.

That is the way i see it.

In my head your method goes like this.

- PHP web page trigger the ssh connection which opens up the login shell script on the remote server and asks for information. Script is now open so it takes stdin info that the user provides and uses them to run the script.

Is that correct or am i far left field in lalaland?
# 19  
Old 04-01-2014
Wouldn't it work to use set -- $2 in your script, given the positional parameters are as given in post#1?
# 20  
Old 04-01-2014
I haven't tried but that was said a little bit before. I think it should work if i split the $2 correctly.
# 21  
Old 04-01-2014
Quote:
Originally Posted by maverick72
Is that correct
Yup.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for login user and email

Guys please help me I have a linux class and I want to write a shell script who shows which user loged in and show the process that are active in his/her shell in another text file and email that file to root just when the user loged out Thanks every bod (1 Reply)
Discussion started by: hamedk1122
1 Replies

2. Shell Programming and Scripting

How to login as a different user inside a shell script?

hi, i want to login as a different user inside a shell script and then call another shell script from that script. how to do that? original script : script_A.sh so when the script_A.sh is called , i want to login as a different user and then call another shell script(script_B.sh) from... (3 Replies)
Discussion started by: Little
3 Replies

3. Shell Programming and Scripting

passing login details to htaccess login prompt

Hi, How i can pass the login details to the URL which is password protected with the htaccess using command line or script (perl,or shell,or php). Any help or hint appreciated. Thanks, SJ (4 Replies)
Discussion started by: SilvesterJ
4 Replies

4. Shell Programming and Scripting

Help with Unix bash shell script login

Hi, I am a complete Unix novice and need some help with creating a login shell script. I have created a file with user details i.e. PIN, name etc and require help in recalling the specified details from the file and being prompted for a password on login. Any help would be very much appreciated.... (0 Replies)
Discussion started by: tdsrogers
0 Replies

5. Shell Programming and Scripting

SSH - Passing Unix login passwords through shell scripts

Hi All , I need to call a script runscript_B.sh on server A, the runscript_B.sh script locating in server B. The runscript_B.sh in calls another script runscript_A on server A itself. it seend, i need to be connect from Server A to Server B using ssh. I have tryed like this in... (3 Replies)
Discussion started by: koti_rama
3 Replies

6. Shell Programming and Scripting

Login with Shell Script.

Dear All, I need to create a shell script which will login to a unix system with user root. I also need to supply the password for root through script only instead of entering it manually. After i am logged in to the system i need to excute all the necessary commands. so far i have done... (7 Replies)
Discussion started by: Siddheshk
7 Replies

7. Shell Programming and Scripting

login from a shell script?????

Any help on this ..... its a bit urgent !!!! Hi Can anybody provide info about the following??? i want to issue su (switch user) command from within a shell script how to take the password without user intervention from the shell script only???? i.e using apssword which is already... (2 Replies)
Discussion started by: skyineyes
2 Replies

8. HP-UX

cannot login after changing login shell

Hello Everyone, I am a newbie in unix. I was practicing shell scripts on hp unix machine. I changed my current login shell (Korn) to Bourne shell giving the following command. $ chsh username /usr/bash I am using secure shell client for accessing the hp ux server. After which i... (4 Replies)
Discussion started by: hardesh
4 Replies

9. Shell Programming and Scripting

remote-login via Shell-Script

Hello all, I would like to login from one unix-system with a (tcsh)-script to an other unix-system.The login-procedure and the transmission of username, resp. password runs via ssh. The problem is after logging onto the remote server once "Enter" has to be pressed, before one gets to the... (1 Reply)
Discussion started by: Juergen Paepke
1 Replies

10. UNIX for Dummies Questions & Answers

remote login via shell script

is it possible for me to have a shell script log me in to a telnet session? i have in mind something along the lines of % telnet host < script, where the first two lines of script will be username and pass followed by a list of commands to execute on the remote host. this doesn t work as... (4 Replies)
Discussion started by: lethe
4 Replies
Login or Register to Ask a Question