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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to scp File from root user in one server to say crt user in another server and avoid password?
# 1  
Old 08-28-2014
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

Last edited by rbatte1; 08-28-2014 at 11:55 AM.. Reason: Spellings
# 2  
Old 08-28-2014
Hi,

You'll have to setup the known hosts file to do this, the file should reside in the users home directory - it's better to use a regular user to do this rather than root for security reasons.

There is a good tutorial here.

Regards

Dave

Last edited by gull04; 08-28-2014 at 11:22 AM.. Reason: Added link
# 3  
Old 08-28-2014
Dave,

The file is coming with root user only...
# 4  
Old 08-28-2014
Hi,

OK, then you'll have to set up the known_hosts and the authorized_keys in the .ssh sub-directory under the home directory for the root user.

There is an example tutorial at the link I posted and there are examples in the forum like the one here.

Regards

Dave

Last edited by rbatte1; 08-28-2014 at 11:57 AM.. Reason: Spelling of authorized_keys file
# 5  
Old 08-28-2014
I do this all the time.
If you have your ssh keys and ssh agent setup, then this will be easy.
You will also need to use sudo.

Code:
ctr@abc> sudo scp filename ctr@hfg:/location

.
or
Code:
ctr@hfg> sudo scp ctr@abc:/fileame /location

I hope this helps

Last edited by rbatte1; 08-28-2014 at 12:57 PM.. Reason: Spelling
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Setup Samba Server to always ask user and password

How do I setup a Samba server to always ask to user and password, when a windows user, prints your files using a shared printer through a Samba Linux Server (CUPS)? (0 Replies)
Discussion started by: viga
0 Replies

2. Shell Programming and Scripting

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... (7 Replies)
Discussion started by: Moon1234
7 Replies

3. UNIX for Dummies Questions & Answers

Terminate scp when user not enter the password.

Hi All, Is there any way to terminate scp command when the password was not entered for some specific amount of time. (1 Reply)
Discussion started by: Girish19
1 Replies

4. Shell Programming and Scripting

How to give user name and password in a single command to login to remote server

Hello All, I'm new to unix and i need the below favour from you. I have list of 50 unix server. I need to login to all the server one by one and with the same user and password. I will declare the user name and password globally in the script. for example : servername- hyperV user name... (4 Replies)
Discussion started by: Hari A
4 Replies

5. Linux

How do I run HTTP server on port 80 using a non root user?

Hi experts, I want to run HTTP server on port 80, I learn from somewhere that it MUST not be run as root for security reason, how to do that? Thank you in advance! (14 Replies)
Discussion started by: kevintse
14 Replies

6. UNIX for Dummies Questions & Answers

How to avoid logging with root user?

I have created a linux machine and installed some softwares on it with root user privileges . I used to login with root user credentials for doing the various task. Later i have realise that this is not the best practice to follow and there should be a new user with less privileges to be created... (1 Reply)
Discussion started by: pinga123
1 Replies

7. Shell Programming and Scripting

[SSH] Need to connect to remote server as different user and without password

I have a task requiring that USER_A run a script, which connects to HOST_B as USER_B and does not ask for a password. If I am logged in on HOST_A as USER_B, I can connect to HOST_B without a password, no problem. However, if I try running ssh with the command line "ssh USER_B@HOST_B" while... (3 Replies)
Discussion started by: Totengraber
3 Replies

8. 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

9. 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