- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Use scp and to exit if password prompted
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
Discussions
Discussions
Forums
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
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
тАО06-05-2011 11:24 PM
тАО06-05-2011 11:24 PM
In a HPUX shell script, we are doing scp to a node....
But sometimes it asks for password for some servers..... What I need is that if on scp password is prompted then to exit the scp and if no password prompted then do the required steps....
Please to provide any help
Regards;
Ajay Saini
Solved! Go to Solution.
- Tags:
- scp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2011 11:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 04:07 AM
тАО06-06-2011 04:07 AM
Re: Use scp and to exit if password prompted
> But sometimes it asks for password for some servers.
Then, fix the fundamental problem if this isn't the desired behavior. Make sure that you have setup public ssh keys for the node(s) in question.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 04:48 AM
тАО06-06-2011 04:48 AM
Re: Use scp and to exit if password prompted
If you want to use only public-key
authentication, then you might try adding
something like the following to your scp
command:
-o AllowedAuthentications=publickey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 07:05 AM
тАО06-06-2011 07:05 AM
Re: Use scp and to exit if password prompted
When calling scp, use the option/qualifier of
-o BatchMode=yes
This will tell scp (or any ssh-family tool) that it should not prompt the end user for a password. (as if being run by script, or cron job)
With BatchMode turned on, if scp cannot connect with the keys in $HOME/.ssh/ dir, then it will show you a message on stdout, and the script will keep moving, rather than stop/prompt, so you never see the "Password:" message.
Read this, and many other useful options in the general "ssh" man-page, or see details in "man 5 config"
Joseph.
HPUX web-man-pages are confused this week,
you might try:
http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1
http://unixhelp.ed.ac.uk/CGI/man-cgi?config+5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 08:41 PM
тАО06-06-2011 08:41 PM
Re: Use scp and to exit if password prompted
It resolved the issue
Regards;
Ajay Saini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2011 10:49 AM
тАО06-30-2011 10:49 AM
Re: Use scp and to exit if password prompted
I use scp -B after doing the ssh key exchange.