Help on scp command usage


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help on scp command usage
# 1  
Old 02-18-2013
Help on scp command usage

As part of our project dev , we need to create a shell script that
COPY FILES FROM A SEPCIFIC DIRETORY OF THE LOCAL SYSTEM INTO A SPECIFIC LOCATION OF A REMOTE SERVER.

Code:
USER1@SERVER1/Dir1/*.* ------- >USER2@SERVER2/Dir2

The main issues with this is requirement are :
1. THERE'S ONLY ONE SPECIFIC USERID (USER1) CONFIGURED TO THE SOURCE SYSTEM WHICH HAS PRIVILDEGES OF FILE TRANSFER FROM SERVER1 TO ANY OTHER REMOTE SERVER, HENCE WHATEVER SESSION MAY THE SHELL SCRIPT RUN IN, IT NEEDS TO SET IN SUCH A WAY SO AS TO EXECUTE THE FILE TRANSFER PROCESS USING THE SESSION OF USER1 ONLY
2.IF I AM USING THE SCP COMMAND , HOW WILL I BE ABLE TO AUTOMATE THE PASSING OF PASSWORDS TO THE SCRIPT ?

Any other alternatives will be higly regarded.

Additonal Info : I am using Korn Shell to build the script.

Thanks
Kumarjit.

Last edited by kumarjt; 02-18-2013 at 11:20 AM.. Reason: Need to add the shell details
# 2  
Old 02-18-2013
Passwords are less secure than setting up a nice long PPKey so the acting user has access to the other user's account. Otherwise, as passwords in ssh scp sftp are read from /dev/tty to discourage this, you need to run scp in something like 'expect' to be able to write the pseudo tty of the scp with the visible password.
# 3  
Old 02-19-2013
Help on scp command usage

Hai DGPickett,

I am a kid in unix,i request you to explain in such a way that i can understud the above published comments..

Thanks & Regards
-----------------
Anil Kumar
# 4  
Old 02-19-2013
'interactive password authentication' means 'password typed by a human being in realtime authentication' and no artificial substitutes for 'human' are acceptable. This is because stored passwords are almost impossible to keep safe.

Fortunately, there's a much better way to automate ssh/scp/sftp passwords -- keys. (Note that ssh, sftp, scp all use the same protocol, and the same keys.) They were designed for this purpose. Just having the right files in the right places on both the client and the server will allow the client to login to the server automatically.

Instead of sending a password, it sends an encrypted key. This key is generated by the ssh-keygen command.

It resides in the ~/.ssh/ directory on both the client and server. The client has the key files themselves. The server just has the key listed in authorized_keys.

If you have the ssh-copy-id command, this will be brief and simple to set up from the client:

Code:
# Just hit enter to all the questions this asks you
$ ssh-keygen -t rsa

$ ssh-copy-id username@host

# Should now login without a password
$ ssh username@host

# 5  
Old 02-19-2013
Yes, the ssh-keygen generates a public and private key. The script installs the public key in the other sytem-user's trusted users file, and you are now connecting passwordlessly. Keys are stored in ~/.ssh/ or ~/.ssh2/ unless it is a mount point, and then it is configured to a different subtree.

There are also trusted keys for the hosts stored at the client side. Now, the client knows it is talking to the same host, and the user knows it is talking to the same user.

(They encode some data with their private keys and the other side decodes it with their public keys, and that data supports a secured session of a limited length until a new session key is generated.)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

scp command help

I need one help. I want to copy specific folder/file from one Linux servers to another. I want scp command that will search the file/folder in given path of one server and copy that result on another remote server. Kindly help me to resolve issue Thanks and Regards, Rajesh (4 Replies)
Discussion started by: Nawrajesh
4 Replies

2. UNIX for Dummies Questions & Answers

help with scp command

Can someone please help me with what is wrong with this command? scp oracle@hrkpd124:/u01/app/oracle/rdbms/admin/dpoo.html root@hrkpmgmt:/export my intention is to copy the file dopp.html from the server hrkpd124 to the server hrkpmgmt but i am getting the error... (3 Replies)
Discussion started by: dollypee
3 Replies

3. Shell Programming and Scripting

Need help in using scp command

Hi all, I want to copy files from unix server to another unix server with out any password. Can some one please explain me the steps involved in achieving this with the actual commands and the sequence of commands i details. I tried my luck ith below procedure but it was not working. #... (1 Reply)
Discussion started by: p2winzip
1 Replies

4. UNIX Desktop Questions & Answers

scp command

if i use scp command to copy a file from one server another server it is asking password of the server from where the file being copied. i am automating some reports.. i need the file to be copied without asking the password. can any help me out??? thanks in advance, Arun Manas (1 Reply)
Discussion started by: arunmanas
1 Replies

5. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

6. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

7. Shell Programming and Scripting

Help with SCP command

Hi, I have around 100 files which are aroun 10 MB in size and need to SCP all those files to another machine. Could you please suggest which way is efficient to do? 1. Gzip each file and transfer one by one. 2. Tar all the files together and then gzip it and send one HUGE file. Basicaly... (3 Replies)
Discussion started by: robinbannis
3 Replies

8. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

9. UNIX for Dummies Questions & Answers

scp command

I want to know how can i use scp command in the reverse fashion meaning i have two machines server1 and server2 I have files in server1 that i need to copy to server2 But i do not have write permissions on server2 although i have read permissions on server1 is there a way i can go... (3 Replies)
Discussion started by: bn_unx
3 Replies

10. UNIX for Dummies Questions & Answers

SCP command

Hello, Let's say I have the command line: scp -r /home/Mohit/Switches mkakkar@softmon:/home/mkakkar/ If I put a "/" after the Switches such that I get: scp -r /home/Mohit/Switches/ mkakkar@softmon:/home/mkakkar/ How does the behaviour change? (1 Reply)
Discussion started by: mojoman
1 Replies
Login or Register to Ask a Question