- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script to automaticly log on remote server HP-...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 07:19 AM
04-06-2006 07:19 AM
I am looking to set a script to automaticly login via SSH to an HP9000 server and excecute some commands on the remote server.
I tried with: echo password | ssh user@server1 but no way, the script hangs on the SSH password prompt :-(.
Any help ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 07:31 AM
04-06-2006 07:31 AM
Re: Script to automaticly log on remote server HP-UX 9000
Do a man on "ssh-keygen"
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 07:38 AM
04-06-2006 07:38 AM
Re: Script to automaticly log on remote server HP-UX 9000
http://docs.hp.com/en/T1471-90015/ch01s13.html
Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 07:38 AM
04-06-2006 07:38 AM
Re: Script to automaticly log on remote server HP-UX 9000
- don't you have a good link to this ssh-keygen cause I do not have access to the server now.
- If I do this, may I then run a script such way:
script.sh | ssh user@server1
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 08:03 AM
04-06-2006 08:03 AM
Re: Script to automaticly log on remote server HP-UX 9000
To tell you the truth, I have read the doc but did not find out how to enable my existing user to log on the remote host without password.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 09:02 AM
04-06-2006 09:02 AM
SolutionI would really consider setting up the proper ssh keys. In the long run it will make administration a lot easier.
I'm including a word document that also describes configuring SSH on hpux. Hope you find it useful.
Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 09:08 AM
04-06-2006 09:08 AM
Re: Script to automaticly log on remote server HP-UX 9000
Is it possible to use SSH with non-password with local-machine/user1 and remote-server/user2 .. cat id_rsa.pub (user1) >> ~/.ssh/authorized_keys (user2)
then ssh user2@remote-machine 'commands'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 09:28 AM
04-06-2006 09:28 AM
Re: Script to automaticly log on remote server HP-UX 9000
Another smart tool is cfengine. You have to configure and program it, but if you make it work it is realy a time saver.
cd .ssh
cat id_dsa.pub >> authorized_keys
ssh localhost
or
ssh localhost "command;command;command"
as you will se it works. If it should by change not work, you will have to make changes in you sshd_config.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 09:39 AM
04-06-2006 09:39 AM
Re: Script to automaticly log on remote server HP-UX 9000
host1 -> localhost (user1):
ssh localhost "command"
ssh -l user2 localhost "command"
or
ssh user2@localhost "command"
from host1 to host2 (remote - user1)
ssh host2 "command"
ssh -l user2 host2 "command"
or
ssh user2@host2 "command"
You just have to have all the keys in place.
You could alsow use the local machine name instead of the localhost. That would make it nice from a scripting point of view.
#!/usr/bin/ksh
SERVERS="s1 s2 s3 s4"
for i in $SERVERS
do
ssh -l root $i "command"
if [ $i = "s1" ]
then
ssh -l user1 $i "command"
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 09:40 AM
04-06-2006 09:40 AM
Re: Script to automaticly log on remote server HP-UX 9000
My question is about using two different users : user1 on localhost and user2 on remote machine.
BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2006 08:14 PM
04-06-2006 08:14 PM
Re: Script to automaticly log on remote server HP-UX 9000
The thing is that the pub file authenticate with user specified in the pub file to a given remote server and user.
if you are userlocal...
cd ~/.ssh
cat id_dsa.pub >> authorized_keys
and to copy to remote.
cd ~/.ssh
scp ./id_dsa.pub remoteserver:/tmp
ssh -l userremote remoteserver "cat /tmp/id_dsa.pub >> ~/.ssh/authorized_keys; rm
/tmp/id_dsa.pub"
YOU HAVE TO TYPE PASSWORD 2 TIMES...
Now you are ready for the script:
#!/usr/bin/ksh
# filename : /usr/local/bin/ssh_script.ksh
# this will work without password
SERVERS="localserver remoteserver1 remoteserver2"
for i in $SERVERS
do
if [ $i = "localserver" ]
then
ssh -l localuser $i "command"
else
ssh -l remoteuser $i "command"
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2006 04:47 PM
04-07-2006 04:47 PM
Re: Script to automaticly log on remote server HP-UX 9000
Then with a script you would be required to interact with the shell.. If you want to automate some type of file activity expect will give you the best results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2006 10:05 PM
04-09-2006 10:05 PM
Re: Script to automaticly log on remote server HP-UX 9000
BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2006 10:12 PM
04-09-2006 10:12 PM
Re: Script to automaticly log on remote server HP-UX 9000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2006 12:22 AM
04-10-2006 12:22 AM
Re: Script to automaticly log on remote server HP-UX 9000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2006 12:22 AM
04-10-2006 12:22 AM