LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-17-2007, 09:44 AM   #1
TheBaker
LQ Newbie
 
Registered: Aug 2007
Posts: 3

Rep: Reputation: 0
Question Transferring Files From A Remote Computer


I have rather an interesting problem (or at least, I have a problem). I've been asked to make a backup of a MySQL database on a remote computer. I've been given an account on the computer which I can log into via SSH.

Unfortunately though, there's a problem with MySQL on the computer and they can't get it to start. So what I've resolved to do is take a copy of the MySQL data files which will serve as a backup until such time that MySQL is up and running and I can take a mysqldump.

To access the MySQL data files, I had to sudo su to the mysql user, and then I copied the files across to my users home directory on the remote machine (I created a folder with 0777 permissions so the mysql user could write to it).

So now I have a load of files owned by mysql in a remote directory owned by me, and I need to get them onto my local computer. But I'm not sure how to do this!

If the files were owned by me, I could just download them - but as they're not I keep getting Permission Denied errors. I've tried changing the owner, group and permissions but keep getting errors.

Any ideas? I'd be very grateful for any help.

N.B. My local computer is a Mac, but the remote computer is Linux.
 
Old 08-17-2007, 09:45 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
rsync or scp can copy files over ssh to and from remote servers to local machines.
 
Old 08-17-2007, 10:18 AM   #3
TheBaker
LQ Newbie
 
Registered: Aug 2007
Posts: 3

Original Poster
Rep: Reputation: 0
And how would I use those? Would they work as my user, or would I have to be the mysql user to transfer them?
 
Old 08-17-2007, 10:50 AM   #4
lakris
Member
 
Registered: Sep 2004
Location: Stockholm, Sweden
Distribution: Ubuntu, RedHat, SuSe, Debian, Slax
Posts: 102

Rep: Reputation: 15
Quote:
Originally Posted by TheBaker View Post
And how would I use those? Would they work as my user, or would I have to be the mysql user to transfer them?
If it is possible to login remotely with the mysql user, use from your own machine

scp -r mysql@remotemachine:/var/lib/mysql .
or
rsync -az mysql@remotemachine:/var/lib/mysql .
(check location of the mysql database dir)

The mysql user can change permissions on the files in the "0777" folder. One could zip them for easy handling. Only root can change owner.

And in case You can't login as mysql user, go to the other machine, sudo su to mysql user, cd to your normal users dir, and
scp -r 0777dir you@yourmachine:
or
rsync -az 0777dir you@yourmachine:
they will be owned by you on your machine.

Last edited by lakris; 08-17-2007 at 11:39 AM.
 
Old 08-17-2007, 11:41 AM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
I wouldn't login as the mysql user and in some cases mysql doesn't have a valid shell or actual password (since it's used to run as a service).

Depending on the permissions, it should allow you to copy the files remotely to locally, if not, change the permissions or ownership temporarily, not like you can't change it back..
 
Old 08-17-2007, 02:22 PM   #6
TheBaker
LQ Newbie
 
Registered: Aug 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks guys, that worked great.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send large files to a remote computer (backup) glenn69 Linux - General 4 04-11-2007 09:56 PM
Transferring Hard Drive to Newer Computer kaplan71 Fedora 1 11-04-2005 01:32 PM
How To Remote Backup Files From Another Linux Computer? knight2k Linux - Software 2 08-17-2004 03:50 AM
Opening remote files (during ssh session) with applications on local computer? The_Fed Linux - Newbie 3 05-10-2004 04:20 PM
Transferring my /home directory from one computer to another. BBlalock Linux - Newbie 4 06-25-2002 10:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:06 PM.

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