remote login through a script ( except rsh)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers remote login through a script ( except rsh)
# 1  
Old 08-22-2001
remote login through a script ( except rsh)

Hi Guys,

I'm having a problem trying to change to a different user within a script .
I want to change to a specific user and then run the subsequent commands using his previleges .

I remember having used ' su ' some years back for this , can't figure it out now !!

Help appreciated .
# 2  
Old 08-22-2001
Have you checked the man page for su?

Try: su - username -c "commands"


# 3  
Old 08-22-2001
login as a different from within a script

Can login using su - username commnads , but i need to use it in a script ....how do i specify the password within the script ??
# 4  
Old 08-23-2001
May be try set UID bit for your script and change owner for it to needed user?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running a script on remote server kills my login session

Hi there, I'm trying to run a script remotely on a server in a particular directory named after hostname which already exists, my login session gets killed as soon as I run the below command. Not sure what is wrong, is there a better way to do it ? Note: I can also use nohup command to run... (14 Replies)
Discussion started by: mbak
14 Replies

2. Shell Programming and Scripting

How to exit shell script if remote login unsuccessful?

#!/bin/bash for servers in `cat ~/servers` do rosh -l root -n $servers 'if then echo $HOSTNAME else exit 1 fi' done I have few servers in the for loop that is powered off, so whenever I execute my script, it works fine if all the servers are on, but when it tries to execute the script... (1 Reply)
Discussion started by: Rojan Shakya
1 Replies

3. Shell Programming and Scripting

Remote login and running a script on multiple servers

Hi all, I am baffled on this. Solaris Irix system.:confused: I have 4 servers all connected to one another, :b: I need to write a script line that would login on to server 1-3 ($HOST) start a script in the back ground and log off while the back ground script runs over a length of time.:eek: ... (10 Replies)
Discussion started by: weddy
10 Replies

4. Shell Programming and Scripting

SFTP script to automate login in to remote server

Greetings, guys. I'm not much of a programmer forgive me for being a noob, because of someone leaving, I was put in an IT spot where I have to figure out a few things. Being new to Linux and programming has been a challenge. My boss has asked me to create an automated script to connect to a 3rd... (7 Replies)
Discussion started by: giovannym
7 Replies

5. Solaris

how to login with ssh to remote system with out applying the remote root/usr password

how to login with ssh to remote system with out applying the remote root/user password with rlogin we can ujse .rhosts file but with ssh howits possible plz guide (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

6. Shell Programming and Scripting

without password to login into remote machine- in the script ??

HI, I need to write a script .. when I run this script , will directly goto that remote machine without asking password.. Once it is entered, I needs to transfer some of the log files... how can I proceed ? (7 Replies)
Discussion started by: hegdeshashi
7 Replies

7. Shell Programming and Scripting

rsh help - getting the output of remote script to local server.

Hi, I have a script that runs for an hour. Have to run it on remote server and need the output it produces on the remote server to decide for failure or success. I run it through a Autosys Job which logs the outputs, both 1 & 2. I use the commands 1) rsh <SERVER> 'nohup /tmp/xyz.ksh &' 2)... (5 Replies)
Discussion started by: aster007
5 Replies

8. Shell Programming and Scripting

Script using rsh(remote shell)

Hi, I am writing a script that will require me to perform tasks across servers. I tried to use rsh <host> "Commands..." > /dev/null 2>&1. However, I am required to execute a long series of commands after that and rsh does not seem to support this and its also insecure. I tried to use rsh to... (5 Replies)
Discussion started by: joseph_ng
5 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