LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-20-2005, 05:25 AM   #1
abhijeetudas
Member
 
Registered: Sep 2004
Distribution: Redhat / Fedora
Posts: 114

Rep: Reputation: 15
Copy Files across two machines.


Hi there,

I have 2 Linux Box'es with sshd modified so that
no root login's are permitted

I am trying to expirement with DRBD
so i need a mechanism that will copy the updated config file
say on node1 to the other node2.

Now these files are needed to be owned by root
so i cannot ssh / rsync across as root.

earlier i had the same thing working as i had ssh host keys installed
so i simply said
[ root@node1 etc ]# scp drbd.conf node2:/etc
& it worked

but after securing the box for no root logins i have this problem of copying
config files from /etc to the other node

any suggestions / ideas on how do i go about this?
 
Old 04-20-2005, 05:55 AM   #2
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,291

Rep: Reputation: 52
You could make a script that does
Code:
user@node1/etc$ scp drbd.conf node2:/tmp
ssh -l username hostname \
password \
sudo mv node2:/tmp/drbd.conf node2:/etc \
exit
or similar.
 
Old 04-22-2005, 09:49 AM   #3
abhijeetudas
Member
 
Registered: Sep 2004
Distribution: Redhat / Fedora
Posts: 114

Original Poster
Rep: Reputation: 15
Dint quite get it
ssh -l username host \ password


"password in plain text ?


Any way i tried

#!/bin/bash
scp /etc/drbd.conf node2:/tmp
ssh -l user host
<manually enter password>
sudo mv node2:/tmp/drbd.conf node2:/etc
exit


i get to a shell prompt and its stuck there
no no nothing.. happened. :-(
 
Old 04-22-2005, 07:03 PM   #4
Linux~Powered
Member
 
Registered: Jan 2004
Location: /lost+found
Distribution: Slackware 14.2
Posts: 849

Rep: Reputation: 33
You can use either SCP or SFTP. SFTP is more convenient. Just run the syntax...

Code:
sftp user@address
You'll be prompted for a password. Once in, you'll want to get a list of the commands that you can use with SFTP. At the >sftp part just type in help, and it'll show you a list of commands. Most common are put and get.
 
Old 04-25-2005, 12:01 AM   #5
abhijeetudas
Member
 
Registered: Sep 2004
Distribution: Redhat / Fedora
Posts: 114

Original Poster
Rep: Reputation: 15
Interstingly enough..

Firstly
1) I had disabled root logins through ssh for security reasons..

2) The file that i need to copy needs to be done through a script

3) The file needs to be owned by root, so will have to copy to a temporary
place n then copy of sudo or somet thing like that.


so i think
sftp user@host is not a good idea.!
 
Old 04-25-2005, 01:50 AM   #6
chrisfirestar
Member
 
Registered: Sep 2003
Location: Adelaide, Australia
Distribution: Fedora/RH
Posts: 231

Rep: Reputation: 30
why dont you copy to a temporary folder using your standard rsync (as you did before)
then just have a sh script that is owned by root then how you want to run this script is up to you, can have a cron job which will go in, copy to the /etc location and chmod it...
 
Old 04-25-2005, 03:50 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can use the .ssh/authorized_keys file to eliminate the need for a password in a script.

An alternative is to use keychain. You could edit your .bash_profile file adding something like

keychain id_dsa
. ~/.keychain/$HOSTNAME-sh

You would be prompted once for a password when logging in the first time after a reboot.

Also, I'm not sure if you have system wide keys in /etc/ssh/ whether the scp commamd will work even if root can't login.

---

I just had another idea. Instead of having a cron job that copies files to remote systems, have cron jobs in the remote systems that pulls the files from the central host. You could pull them from a user setup solely for the purpose of distributing files. The home page of this psuedo user would contain an .ssh/ directory and the remote systems would be copying from a user account so your no root login restriction wouldn't be a problem.

Last edited by jschiwal; 04-25-2005 at 04:29 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Diff on files which are on seperate machines subu_s Programming 1 12-06-2004 06:55 AM
how to share files between two linux machines mchitrakar Linux - Newbie 4 08-12-2004 07:24 AM
Need to copy OS + hard drive contents between two machines with different hardware. tayo Linux - Newbie 12 07-24-2004 10:19 AM
New to networking, have 2 Mandrake 9.2 machines... want to share files Fear58 Linux - Networking 2 06-29-2004 01:27 AM
how to copy and paste between files and within files Bheki Linux - General 1 02-05-2002 05:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration