LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-24-2005, 02:51 PM   #1
john8675309
Member
 
Registered: Oct 2003
Location: Spencer, Iowa
Distribution: Slackware (of course)
Posts: 67

Rep: Reputation: 16
Moving /etc/passwd and /etc/shadow


How can I move the /etc/passwd and the /etc/shadow to another directory? When I try to move it and then change a user password it segfaults.

--John
 
Old 01-24-2005, 08:44 PM   #2
john8675309
Member
 
Registered: Oct 2003
Location: Spencer, Iowa
Distribution: Slackware (of course)
Posts: 67

Original Poster
Rep: Reputation: 16
Got this answer from a friend:

to show all the files that contain /etc/passwd
find / -type f | xargs grep -l /etc/passwd


Important:
"/etc/passwd" has 11 characters,
so any replacement with 11 or less characters will make
it easy. Let's say you wanted to replace "/etc/passwd" with
"/vol/passwd". You could run:

find / -type f | xargs perl -i -pe 's~/etc/passwd~/vol/passwd~g'


to change the passwd file to "/x/y". You'd have to add 7 nulls. So:

find / -type f | xargs perl -i -pe 's~/etc/passwd~/x/y\x00\x00\x00\x00\x00\x00\x00~g'

--John
 
1 members found this post helpful.
  


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
usermod, beyond passwd & shadow Hans Zilles Linux - General 0 11-26-2005 05:29 PM
passwd shadow problem rblampain Linux - Distributions 2 10-04-2005 12:00 AM
It is ok if i unshadow the /etc/passwd and /etc/shadow Paxmaster Linux - Software 1 01-12-2005 10:07 PM
mismatch with /etc/passwd and /etc/shadow AngryKeebler Linux - General 1 07-23-2004 03:42 PM
/etc/passwd or /etc/shadow? tiger7007 Linux - Security 2 03-21-2004 04:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:21 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