[Show all top banners]

Saajha
Replies to this thread:

More by Saajha
What people are reading
Subscribers
Subscribers
[Total Subscribers 1]

Slackdemic
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 LINUX/UNIX Geeks - Please Advise!

[Please view other pages to see the rest of the postings. Total posts: 34]
PAGE: <<  1 2  
[VIEWED 12599 TIMES]
SAVE! for ease of future access.
The postings in this thread span 2 pages, go to PAGE 1.

This page is only showing last 20 replies
Posted on 07-17-08 4:52 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I inadvertently did the following: 

mv ../lib* .

from
/local

(which really means - all files inside /lib/ got moved to /local/)

.. and now I CANNOT get into the box. 'Access Denied' as a root or a regular user. However, I still have the currently running SSH session, which doesn't let me do much - except for cd, pwd, echo and couple other basic commands (no cp, mv, ls etc). Can't sudo either (not that it would help much). Anyone has a clue - workaround?

~@~

 
The postings in this thread span 2 pages, go to PAGE 1.

This page is only showing last 20 replies
Posted on 07-17-08 7:47 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

sorry ppl i didn't mean to post same reply three times, somehow it came up
 
Posted on 07-17-08 7:54 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

@sangfroid, ln doesn't work. Creating a sym link and pointing it to /local/lib* is a great idea though!
About sftp and cp, as I mentioned earlier -- there's no need to pull libraries from the other machines - as they already are there, just one directory level below; and since cp/scp/mv don't work, there's no way I can copy those files. I can go into /local and see all lib* files by doing echo* -- just cannot move them, or point to them as you suggested!

@instinkt, thnx for your advice - but there are no backups!

@whois, thnx for your initiative as well! I'm trying every possibilities I can think of. Just emailed some opensource communities to see if they have a say for it. Won't be worth spending too much of time on this though ---

~@~

 
Posted on 07-17-08 8:08 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

As Sun4u said ,We also need to have better communtiy!!!!
I can see so many people in this field here!!!

 
Posted on 07-17-08 8:29 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Ok, mirrored disk .. hmm..!! What difference would it make if you boot from the mirrored disk? Wouldn't that have a mirror copy of settings and configurations on it as well?

 
Posted on 07-17-08 8:32 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

seeking help from auto mirrored disk is of no use......

this is its main drawback.... corrupted data also gets copied ....

 
Posted on 07-17-08 8:35 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

That's exactly what I thought !!!
 
Posted on 07-17-08 8:49 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

the only way i can think of is to access the machine physically and boot it off of cd and fix it !


 
Posted on 07-17-08 8:56 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I agree with you @babali, that's always an option --- but if there was a way to somehow inject those files into it, that would be magnificent!!

 
Posted on 07-17-08 9:02 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

.

I just wanted to say You're doomed buddy ;)

The first solution that comes to my mind would be: Boot it from a LIVE CD or sth, mount it, do the necessary copying, and voila!

THE other play that i would possibly do is: (not sure if it will work)

Find any source files (copying scripts) installed that didnot have dependency on /lib folders. (scp, sftp, rsync, copywhendisaster) - very dim chance. Or else, if there's anyway you can compile scripts , run gcc for that matter, use cp.c in coreutils/src to generate a binary (on that machine or a dift one) to move files back. I bet all of these would just be FOR FUN.

I would suggest you, if you cant anyhow follow the first option, start again. Accidents Happen ;)

 
Posted on 07-17-08 9:11 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

.

And whats the mailing list / forum that you posted this on ? I'd like to keep an eye to think of any other options too.

 
Posted on 07-17-08 9:40 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

mv does not mean you moved it. It means it got renamed.

e.g. mv x x.bkp means file x got renamed x.bkp.

So when you did -> mv ../lib* . from  /local, I believe the files with beginning with "lib" became ".".

I believe cp would have copied the files.
 
So I think booting the server with a live cd, then mounting the file systems and then doing,

cd  to /local

then doing mv again to all the renamed files might help.

I guess I would make sure how the files will get renamed back by checking the contents of the . dir...

What do you have under /lib? are there files simply named "."??

K'dude

 

 
Posted on 07-17-08 10:04 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

.

Katmandude,

$mv ../lib* .
from /usr/local/ would copy(move) the folder /usr/lib into /usr/local as /usr/local/lib.

Saajha, Can you think of a way, you can simply ask the OS to boot using /usr/local/lib instead of /usr/lib to find its libraries , provided the permissions are ok on the copied files. Something like LIB_PATH or editing init interfaces? I guess that'd still be the other workaround.

PS: LD_LIBRARY_PATH / ldconfig ??? These might come handy, the command of these sorts.


# /sbin/ldconfig -n /usr/local/lib


Last edited: 17-Jul-08 10:19 PM

 
Posted on 07-17-08 10:47 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

You are right Oldmaven...rebuild.

 
Posted on 07-17-08 11:11 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 

1. You said it is not production box, not much critical, so take it easy.. grab a cup of black coffee and take a long deep breathe. And dont forget to thank god, it was mv command, not rm.

2. Talk to your boss, dont feel embarrassing. Shit happens.. specially in sys admin job. He will understand it.

3. No backup, no root privilege and working on remote machine = You can not do anything in this case.

4. Guys, he is saying- he can not issue any system-level commands, so forget about rebooting / installing with LIVE CD . Unless there is some back-up/restore script (I strongly believe it should be there), he can not write back to /lib/ as a normal user.

5. Back up what you have copied to your /local directory. Someone with su access will restore back to /lib/.

6. 'mv does not mean you moved it. It means it got renamed.' - Please dont advise unless you know what you are saying..

7. You learn the most when you make mistakes (as long as it is not so disastrous that you will be screwed up.. )
 

 


 
Posted on 07-18-08 9:16 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

@BM: rm or mv -- no difference in this case; these are the libraries that come with OS -- can copy them from a different machine or a CD.

@oldmaven: I like your idea of making the OS look for those libraries under /local/lib instead of /lib during bootup. But that requires editing the script - while no vi or nano gets recognized. Also /sbin/ldconfig couldn't execute. Do you (or anyone) know if a text file can be pushed using echo?

@k'dude: I agree with your explanation on mv and 'rename' being the same (mv is what you really use in *NIX to rename a file) --- someone told me the other day that one of the libraries I moved (renamed) was PAM library, which plays role in authentication; and since the system doesn't find it on its default location (with default name), it cannot verify authentication.



~@~

 
Posted on 07-18-08 9:18 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

having root user as local does not have anything to with /lib folder being moved..
user information is stored in /etc/ folder under passwd file.
which flavor of unix r u using?

try to grep the passwd file for root and look for UID, its the 3rd field separated by ";"
root should have uid of "0".

in order to run other commands you may try to get into the /lib/ folder that you moved your content into then envoking those commands.. (if i am understanding your question right)

Good Luck!

 
Posted on 07-18-08 4:06 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

.

I am finding it hard to believe that echo works but cp doesnt work, when i believe they are from the same directory. /bin/cp , /bin/echo , at least on this not-enterprise edition. Are they in yours?

If you find the magic place to change the library path besides rebuilding kernel, you can easily include it to the end of the script file with echo as  

$echo "LD_LIBRARY_PATH=working/directory" >> script.file   (sth like this to append to the script)

There was one which modifies dynamic library load path of compiled programs and libraries, which you can use for your pam.so if you arent getting the PAM modules for authentication.Its called "chrpath" , but i guess you dont have it installed by default on your machine.

Could you please provide error msgs as well , as what it says . Also possibly point out what scripts work and what dont, which privileges you have, which you dont.

And we can take these discussions off Sajha too, into a total technical arena, if you like.

 
Posted on 07-18-08 9:31 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

@oldmaven -- there's no need to find a separate sandbox for this discussion. I bet San wouldn't mind us exchanging our views here. This is supposed to be an open forum (sabaiko sajha), No?  

Anyways, here's a quick proof of concept I prepared earlier today, mimicking my original steps. Even though this was done on Fedora Core 6, I could replicate the exact same steps/outcome as on RHEL 5 (as anticipated). Want to take a look?

http://www.2shared.com/file/3617119/deb347c/POC.html

@bond_oo7, I can't do grep anymore on this box! You probably didn't read the whole thread? Regardless, I should thank you for the advice! Please keep 'em coming!! 


 
Posted on 07-19-08 1:19 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

.

I think i got it.

$ /local/lib/ld-linux.so.2 --library-path /local/lib /bin/ln -s /local/lib/ /lib

Let us know if it works!

 
Posted on 07-20-08 11:14 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

DUDE -- Two thumbs way up for this effort of yours!!!! YES IT WORKS !!!!!!!!!

It did fine on the virtual machine that I did POC earlier.

I'll reach my 'original' box first thing tomorrow morning  and replicate it! However there's a possible caveat....

This box needs users to sudo into root to do almost everything.  When I did mv ../lib* . , I did it as root. Now that I am a regular user, the question is whether or not this command would execute when I run it as myself. In any case, kudos to oldmaven --- my issue is more of an experimental fun than a necessity at this point (a new machine has already been shipped to the data center). I can always use this one as a load balancer if we decide to keep it there! 

Thanks everyone involved in this discussion thread for your intiative and input.

Technology Rocks ~eh!!

~@~ 


 



PAGE: <<  1 2  
Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 7 days
Recommended Popular Threads Controvertial Threads
I hope all the fake Nepali refugee get deported
Travel Document for TPS (approved)
Those who are in TPS, what’s your backup plan?
MAGA and all how do you feel about Trumps cabinet pick?
MAGA मार्का कुरा पढेर दिमाग नखपाउनुस !
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters