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

Regards
Ujjwal V

like this?

# su - ftptomsp -c "some copy commands"

i am not having root access .....in a shell script , which automatically logs me in using these credentials
username:- ftptomsp
password:- AG53Tt3iK2

ssh user-name@ip 'cmd'

if you have multiple servers however this works within same server too

My server name :- thdb1d02
presently looge in :- ora_toms user

need to login to ftptomsp user by running shell script .

What Operating System and version are you running. What Shell do you use?

Are you logging in for interactive work or are you trying to run a script in another user's account?

What is the problem which you are trying to solve? Would it make a difference if both users were in the same group?

@methyl
HP UX 11i Server
bash
i m logging it through command mode...i would like to run the script ora_toms user account where the script should be able to login to the ftptomsp account

not necessary to be in the same group

I do not understand this post or the other posts with the same words in a different order.

Do you know someone who can help you write the post in better English?

Is the account ftptomsp a ftp account or a Shell account?

Are you sure that you have bash with HP-UX 11i ? It's not impossible, but just very unusual.

Hi methyl

A shell script which can login as another user and perform copy operations.

example

ora_toms@thdb1d01$  ./Sample.sh

The sample.sh
should be able to login as ftptomsp .its a normal account not an ftp account. i just need the logic.script can be provided for any shell

Sample.sh

cd /toms/aps/tmp
login ftptomsp
password AG53Ttsp3iK2
cp file1   /toms/FTP/

The copy operations can be performed only by ftptomsp user.....
i have tried with above script but it is prompting me for password. so, how can i automatically supply a password to that particular user through Shell script.

Regards
Ujjwal V

HI every body

I have found a solution for this thread by running commands as another user in shell script though "SSH Keys Mechanism".

Thanks