Shell script to log into another user


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to log into another user
# 1  
Old 02-12-2010
Question Shell script to log into another user

Hi i have not don anny scripting before so pls answer simpleSmilie

I want to make a shell script that i can use to execute a program on a nother
pc. They are both using CentOS.

The command i use to execute to program from my computer is:

First i open a terminal and write:

#ssh -X gw302 (i am using aliases)

then i am promped for password
after inserting the password i must change user on the other computer:

#su gsss

then i am promped for a nother password
and final i can start the program:

#GPS_SUPERV

Is there a way to make a shell script to do all this?

Last edited by fkildal; 02-12-2010 at 06:14 AM..
# 2  
Old 02-12-2010
Code:
man ssh-keygen

# 3  
Old 02-12-2010
Sorry but that did not say me much

Can u explain a bit to?
Remember i am new to this
# 4  
Old 02-12-2010
This a topic that is easy to google and also easy to find in the forums here using the search engine.
You might want to use some pattern like "ssh without password" for example. If you try it out and it still does not work, post here again with an explicit error description please.
# 5  
Old 02-12-2010
I'll try that

Okey i will try that, have tryed to googled it but have not found any usable there yet.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script newbie- how to generate service log from shell script

Hi, I am totally a newbie to any programming languages and I just started an entry level job in an IT company. One of my recent tasks is to create a script that is able to show the log file of linux service (i.e. ntpd service) lets say, if I run my script ./test.sh, the output should be... (3 Replies)
Discussion started by: xiaogeji
3 Replies

2. Shell Programming and Scripting

How to Switch from Local user to root user from a shell script?

Hi, I need to switch from local user to root user in a shell script. I need to make it automated so that it doesn't prompt for the root password. I heard the su command will do that work but it prompt for the password. and also can someone tell me whether su command spawns a new shell or... (1 Reply)
Discussion started by: Little
1 Replies

3. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

4. Shell Programming and Scripting

How to Login as another user through Shell script from current user[Not Root]

Hi Every body, I would need a shell script program to login as different user and perform some copy commands in the script. example: Supppose ora_toms is the active user ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands ... (9 Replies)
Discussion started by: ujjwal27
9 Replies

5. Shell Programming and Scripting

Shell Script to change a user password using script

Hi Experts, I had tried to executes this script to change the user password through script: No lines in buffer #!/bin/ksh cat /etc/passwd | grep -v userid >> /tmp/pass.tmp1 cat /etc/passwd | grep userid >> /tmp/pass.tmp2 PASS1=`cat /tmp/pass.tmp2 | cut -d ":" -f2` PASS2=`q2w3e4r5` sed... (3 Replies)
Discussion started by: indrajit_renu
3 Replies

6. Shell Programming and Scripting

shell script that will automatically check if specifed user is log in or not, in 30 seconds

guys I need emergency help with below shell script assignment..am new to shell script Write a Shell script to automatically check that a specified user is logged in to the computer. The program should allow the person running the script to specify the name of the user to be checked, the... (2 Replies)
Discussion started by: gurmad
2 Replies

7. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies

8. UNIX for Dummies Questions & Answers

Log out an unauthorized user via shell

I made a check in my system and found a user that was not suppossed to be in. How can I log him out with my prompt? I was thinking to implement Squid as a Proxy server to evade this stuff from happening again, to grant access just at specific times and hours, is it a good program to perform this... (2 Replies)
Discussion started by: agasamapetilon
2 Replies

9. Shell Programming and Scripting

How do i change to super user then revert back to ordinary user ,using shell script?

Hi all, I am trying to eject the cdrom from a livecd after certain stage... Now assuming that it is possible to eject,please consider my issue!!! The OS boots into a regular user by default...so i am unable to use the eject command to push out the drive... However if i try pfexec eject it... (3 Replies)
Discussion started by: wrapster
3 Replies

10. UNIX for Dummies Questions & Answers

User Shell script

I'm very new at this -- HELP! I need to know how to terminate a users session when they exit a shell script menu? Any ideas would be much appreciated! Holli (2 Replies)
Discussion started by: HOlli
2 Replies
Login or Register to Ask a Question