LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-31-2010, 10:32 AM   #1
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Revcovering /etc/ directory


Hi All,

We have a test server in which we have not taken backup. Contents under /etc is entirely lost.

I need to execute scp to copy mysql data directory.

Also it is in remote location. Can I recover the data by scp by creating some /etc/passwd , /etc/shadow files ?

please help...Please I need your help now....
 
Old 08-31-2010, 10:47 AM   #2
suprstar
Member
 
Registered: Aug 2010
Location: Atlanta
Distribution: ubuntu, debian
Posts: 142
Blog Entries: 2

Rep: Reputation: 22
If your /etc is gone, you can't even boot the server, much less log in.. Your best bet will be to gut the hard drive out of the server, put it in a working pc, mount the drive, and recover what you need.
 
Old 08-31-2010, 10:53 AM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by suprstar View Post
If your /etc is gone, you can't even boot the server, much less log in.. Your best bet will be to gut the hard drive out of the server, put it in a working pc, mount the drive, and recover what you need.
Thanks for your reply..

But still I am logged in as root. Any ideas, I have cretaed a root entry in /etc/passwd and /etc/group

I am not able to convert /etc/passwd to /etc/shadow through pwconv getting a /etc/shadow.lock file

But I converted /etc/group to /etc/gshadow using grpconv ...

Any ideas ?

Please help...

Last edited by vinaytp; 08-31-2010 at 10:54 AM.
 
Old 08-31-2010, 02:04 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I'm somewhat puzzled ... if you're still logged in, and scp as such
is still working: why don't you just copy everything /etc from a
similar enough server across?

Log onto the "origin" server (the one with /etc intact).
tar cvzf /tmp/etc.tgz /etc
chmod g+r !:2

On the broken machine:
scp some_user@good_machine:/tmp/etc.tgz /tmp/.

tar xvf /tmp/etc.tgz -C /



Cheers,
Tink
 
Old 08-31-2010, 02:40 PM   #5
suprstar
Member
 
Registered: Aug 2010
Location: Atlanta
Distribution: ubuntu, debian
Posts: 142
Blog Entries: 2

Rep: Reputation: 22
Or better yet,

scp -r /var/lib/mysql root@SomewhereElse:~

If scp works, get what you need off of there ASAP! I'd be extremely hesitant to copy a whole /etc directory from another server. If you have another server around that's similar enough and it works, that's great, but there could be an awful lot of work to tweak everything that is specific to that machine. If you get the /etc from a production server, you could interfere with legit network services, $DIETY only knows what could happen, that sounds reeeeeally sketchy to me.. I might try that as a last resort - the 'hard drive' is really a RAID I can't easily transplant, I can't mount it with a linux boot cd, etc. And I'd make sure it wasn't plugged into my network when I fire it up after that.
 
Old 08-31-2010, 02:49 PM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
I don't think scp will still be working: It probably needs /etc/ssh/*, but maybe these files are still cached, and do not need to be re-read.

I suppose vinaytp could manually re-create those files. If editors are no longer working, he can possibly echo text >> /etc/configfile It all depends on how vital the database data is.

scp is worth trying at least.

In any case, if vinaytp logs out from his current connection, he will not be able to get back in. So best not to do this just yet.
 
Old 09-01-2010, 04:31 AM   #7
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Original Poster
Rep: Reputation: 55
Thanks for all your replys.

When I tried to scp initially I was getting error as user not identified

I followed following steps.

1. I copy pasted /etc/passwd, /etc/shadow and /etc/group files from another server with vi.

2. I copied /etc/pam.d/passwd /etc/pam.d/system-auth files from another server using vi.

3. Now scp started working. I could recover whole my mysql data directory
Code:
scp -r /var/lib/mysql root@ip:/root/
4. After this it took lot of time and my Putty session turned inactive, So I could not copy /etc from other machine.

5. After this I failed to login to the server. Luckily I could download /var/lib/mysql data directory.

Thanks again to all..

Last edited by vinaytp; 09-01-2010 at 04:39 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Changing the password of Directory Manager in Redhat Directory Services sudarshan.bisht Linux - Server 2 11-19-2013 05:33 AM
Username & Password Sync Fedora Directory and Microsoft Active Directory karnac01 Fedora 4 07-19-2010 01:51 AM
change default vsftp anonymous accout directory /var/ftp to other directory? hocheetiong Linux - Newbie 2 01-24-2010 07:33 PM
LXer: Directory services made easy with Fedora Directory Server LXer Syndicated Linux News 0 12-08-2006 04:54 AM
Automatically Copying files from the ftp directory into the html directory swatward Linux - General 3 04-17-2005 11:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration