PDA

View Full Version : Hidden directories


phonecian
19th September 2004, 02:42 AM
I just found two hidden directories on a workstation with a fairly new install of FC2.
/etc/.java
and
/etc/.pwd.lock

I dont know what they do. Are they legitimate FC2 directories. How can I see what is in them?
Thanks

crackers
19th September 2004, 03:48 AM
/etc/.java is a legitimate directory - the Sun JVM uses that to store system-wide preferences information. You'll get that when you run java as "root" - which is the only user that can write to the /etc directory.

The other file (not a directory) I haven't a clue, but it's on every system I have. Add that fact in, plus only "root" can write to this directory, makes me feel quite confident that it's supposed to be there. ;) Looks like it's written during installation...

phonecian
19th September 2004, 04:30 AM

Thanks Crackers

reks
19th September 2004, 04:41 AM
That file: /etc/.pwd.lock seem to be there on all the machines here with me -> FC2, RH all the way down to RH7.2. - Zero size file owned by root. I found it on a Solaris machine (SunOS-5.6) too! However DEC-OSF1 machines dont have it.

On my FC2 machine, the date of creation of the file matches the installation date. I did a google search for that. Found a similar thread in debian list (its there on debian machines too!), but they too were left clueless. :rolleyes:

Wonder what that file does. Its very interesting though. I'll post the question on other lists and get back to this thread if I find any answers.

SuperNu
20th September 2004, 01:40 AM
I ran a quick google search, and it looks like the file /etc/.pwd.lock is created by adduser to lock /etc/passwd so no other files write to it while adduser is.

--SN

reks
20th September 2004, 06:22 AM
Thats right SuperNu.. While my googling didn't reach anywhere, I too got something, thanks to Atul Chitnis (http://atulchitnis.com/)


/etc/.pwd.lock is the lock file. It is used to coordinate
modification access to the password files /etc/passwd and
/etc/shadow. lckpwdf and ulckpwdf are routines that are
used to gain modification access to the password files,
through the lock file. A process first uses lckpwdf to lock
the lock file thereby gaining exclusive rights to modify the
/etc/passwd or /etc/shadow password file. Upon completing
modifications, a process should release the lock on the lock
file via ulckpwdf. This mechanism prevents simultaneous
modification of the password files. i.e. it is a sentinel file,
never modified, only locked and unlocked as required. Think
of it as a semaphore.
Related manpage (http://www.atmosp.physics.utoronto.ca/SX5/docs/g1ab02e/getspent.3c.html)


Cheers! and thanks phonecian for that interesting question :cool:

crackers
21st September 2004, 04:06 AM
Over 10 years using this OS and you still learn something new every day... gotta love it!