Results 1 to 3 of 3
how do i write a shell script to ssh into a remote server with password and run a script in it?...
- 06-26-2010 #1Just Joined!
- Join Date
- Jun 2010
- Posts
- 3
shell script to ssh into a remote computer and run a script
how do i write a shell script to ssh into a remote server with password and run a script in it?
- 06-26-2010 #2
In the simplest form, just
ssh <hostname> <command>
so, for example:
Will return the hostname of remotehost.Code:ssh remotehost.domain.com hostname
The ssh setup will take care of the authentication, be it password or authorized key.You must always face the curtain with a bow.
- 06-28-2010 #3Just Joined!
- Join Date
- Jun 2010
- Posts
- 4
You could use sshpass and specify the password on the command line, obs. this is not recommended for security reasons.
Hope this helps.Code:sshpass -p 'password' ssh user@host command


Reply With Quote