Useradd creates lock files in /etc/ directory. Is it possible make it create them somewhere else?
Asked
Active
Viewed 99 times
1 Answers
0
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.

Janne Pikkarainen
- 31,852
- 4
- 58
- 81
-
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. – Nov 10 '10 at 08:47
-
Edited my reply a bit. – Janne Pikkarainen Nov 10 '10 at 09: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! – Nov 10 '10 at 10:33