Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Useradd creates lock files in /etc/ directory. Is it possible make it create them somewhere else?

share|improve this question
add comment

1 Answer

AFAIK that's not possible without modifying the source code.

Why is /etc problem for you? Do you want to keep it read-only or...?

EDIT: OK, so your /etc is a read-only directory. Would it be possible to you to write a wrapper around useradd? A small script like

#!/bin/bash
mount -o remount,rw /etc (or whatever mount point contains your /etc, maybe just /)
useradd here_be_some_parameter_handling
mount -o remount,ro /etc

would temporarily remount the disk as read-write and then back as read-only.

share|improve this answer
    
That's right /etc/ is a read-only directory. I tried changing the path directly in the binary, but the only string I thought could be the lockfile path apparently is something else cause changing it does nothing, so I will probably have to write some code. –  user58292 Nov 10 '10 at 8:47
    
Edited my reply a bit. –  Janne Pikkarainen Nov 10 '10 at 9:19
    
That's impossible on the embedded platform I'm working on unfortunately. The passwd. group and shadow files are links to a rw partition and I'll probably just use chroot to run adduser from there. Thanks anyway! –  user58292 Nov 10 '10 at 10:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.