I want to scp file from one server to another, both server have different user name and


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I want to scp file from one server to another, both server have different user name and
# 1  
Old 04-23-2015
I want to scp file from one server to another, both server have different user name and

i want to scp file from one server to another. both server have different user name and it needs to give password to transfer file.how can we mention password in the script itself so that we need not mention password while running the script.
Say from servers cpli with user abc and file path /opt i want to transfer file to server cper with user xyz to path /tmp
# 2  
Old 04-23-2015
You don't.

scp is designed to prevent you from injecting passwords in this manner, because it is an extremely bad idea.

Any other sane authentication method also rejects injected passwords the same way -- including su and sudo.

If you want to connect passwordlessly, use ssh keys.
# 3  
Old 04-23-2015
Quote:
Originally Posted by Corona688
You don't.

scp is designed to prevent you from injecting passwords in this manner, because it is an extremely bad idea.

Any other sane authentication method also rejects injected passwords the same way -- including su and sudo.
what other possible way can be possible to do this
# 4  
Old 04-23-2015
# 5  
Old 04-23-2015
Quote:
Originally Posted by Corona688
Any other option other than this possible here
# 6  
Old 04-23-2015
Not any good ones. All other options involve installing third-party utilities and opening up massive security holes.

Why can't you use keys? That's what they're there for.
# 7  
Old 04-26-2015
Network I want to scp file from one server to another, both server have different user name and

Is there any possibility of Invoke user input

Like,using expect script interactive

Code:
expect script.sh user passwd

cat script.sh
Code:
#!/usr/bin/expect
scp ~/text.txt $1@IP: ~/
expect "?asswd:\r"
send "$2\r"
interact

Moderator's Comments:
Mod Comment Please reread the forum rules you agreed to when you joined this forum.
In just five posts, you have broken enough rules to be close to being banned from this site.

Last edited by Don Cragun; 04-26-2015 at 05:59 PM.. Reason: Add CODE and ICODE tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need some help regarding file transfer between server (sftp/scp)

Hi All, Need some help regarding file transfer between server. Suppose we have system-A and system-B. To transfer file from system-A to system-B we usually share the public keys of system-A to system-B and do scp/sftp to transfer a file. Is it possible that public key of system-B can be... (3 Replies)
Discussion started by: abhi_123
3 Replies

2. Shell Programming and Scripting

How to scp File from root user in one server to say crt user in another server and avoid password?

Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password (4 Replies)
Discussion started by: Moon1234
4 Replies

3. UNIX for Dummies Questions & Answers

Use screen command in AIX to scp file to other server

Hello, Please assist me in using screen command in AIX to scp file to other server Best regards, Vishal (10 Replies)
Discussion started by: Vishal_dba
10 Replies

4. UNIX for Dummies Questions & Answers

scp to get a file from windows desktop to UNIX server

Hi, I want to use scp to upload file to my unix server. i am using this: scp D:\testr.txt unixuser@unixhost:/path it returns an error: ssh: D: host/servname not known i am not sure how to tell path of my D drive in the command and how will command understand it has to pick from my... (5 Replies)
Discussion started by: Kohli
5 Replies

5. Solaris

how scp a file to server with space in the directory name

Hello forum, I’m trying to get someone else’s log rotation & sync script working. The ksh script is sending daily compressed log files to a Windows RSA envision server. The name of the directory is “CA SITEMINDER_<IP address of the sending server>”. The servers we are sending from are a mix of... (3 Replies)
Discussion started by: TKD
3 Replies

6. Shell Programming and Scripting

Script to check for the newest file mutiple times a day and SCP it to another server.

Hi, I need a sample of a script that will check a specific directory multiple times throughout the day, and scp the newest file to another server. Example: current file is misc_file.txt_02272011 (the last part is the date), once that has been secure copied, another one may come in later the... (1 Reply)
Discussion started by: richasmi
1 Replies

7. Shell Programming and Scripting

scp file to another server without asking for password

hi I tried reading some of the threads w.r.t scp/sftp file to another server in the same network without asking for password while copying files.....but couldnot succeed. i have generated the public key for the system using "ssh-keygen -t " and kept it in the .ssh/authorized_keys file. ... (8 Replies)
Discussion started by: aemunathan
8 Replies

8. UNIX for Dummies Questions & Answers

File Missing When Grabbing Files from SFTP Server using SCP Command

Hi, I have this problem where sometimes my files would go missing when I schedule my crontab to run the SCP command to get file from the SFTP server. My crontab will run the scripts at an interval of 3 minutes (between the two scripts) The following is the setting in my crontab. ... (1 Reply)
Discussion started by: gingervitus
1 Replies

9. Shell Programming and Scripting

SCP logfiles from one server to another server

Hi, I want to copy all the logs except current date logs from one server to another server every day, so i want to write a script for it and put it in crontab. Can anyone help how to write the script. Regards, Srini (1 Reply)
Discussion started by: srinivasvandana
1 Replies

10. Shell Programming and Scripting

Dowloading a File from FTP Server to a local Server where User Id's are different

Hi, The Setup is like this. I'm connecting to Unix machine from my local machine. After connecting to Unix M/c, i need to connect FTP server. Am successful in connecting to FTP server, but am not able to download the file from the ftp server to my local machine. I have different user id's and... (1 Reply)
Discussion started by: ranjith_taurean
1 Replies
Login or Register to Ask a Question