- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: help on scp script
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
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
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
05-21-2014 05:02 AM
05-21-2014 05:02 AM
help on scp script
Hi
I have the following script, that is not working:
for files in `ls -lrt | awk '{if ($8 == "2013")print $0}'` do /usr/bin/scp -p $files root@10.1.20.31:/fs1/bscsrtx/BSCS_iX/WORK/MP/UDR/RLH/M16S11A4V1A11VRLUCO/ERR/OLD_FILES/ done
so I am trying to copy all 2013 files to another server, so when I run it:
Password: 1: No such file or directory Password:
keeps on asking for password....
- Tags:
- scp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 07:07 AM
05-21-2014 07:07 AM
Re: help on scp script
You need to set up SSH so that it can log into the remote server without asking for a password.
The is done by appropriately setting up public / private key access between the servers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 07:18 AM
05-21-2014 07:18 AM
Re: help on scp script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 07:23 AM - edited 05-21-2014 07:24 AM
05-21-2014 07:23 AM - edited 05-21-2014 07:24 AM
Re: help on scp script
Yes, that should be all that is needed.
Just make sure that the user that is running the scp is that one that is allowed to login as root on the remote server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 07:52 AM
05-21-2014 07:52 AM
Re: help on scp script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2014 10:48 AM
05-21-2014 10:48 AM
Re: help on scp script
>I am trying to copy all 2013 files to another server
If you don't have zillions of files, you can use this to copy all in one scp command:
files=$(ls -lrt | awk '{if ($8 == "2013") print $9}')
/usr/bin/scp -p $files root@10.1.20.31:/fs1/bscsrtx/BSCS_iX/WORK/MP/UDR/RLH/M16S11A4V1A11VRLUCO/ERR/OLD_FILES/
Note: In your original script, you should also be printing $9, the filename and not the whole line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2014 12:37 AM
05-22-2014 12:37 AM
Re: help on scp script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2014 12:38 AM
05-22-2014 12:38 AM
Re: help on scp script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2014 06:43 AM
05-22-2014 06:43 AM
Re: help on scp script
The method of passing the list of files to copy to the scp copy command has nothing to do with how scp actually functions.
If you want to use SCP to copy the files without having to enter a password, then YES you do need to set up public / private keys to enable passwordless login.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2014 08:44 AM
05-22-2014 08:44 AM
Re: help on scp script
>but in this case do I have also to setup connections without passwords?
Well, you'll only need to type in the password once, each time you run the script. :-)