Hi Tomas, Tomas Rippl wrote on Tue, Jan 28, 2025 at 10:52:27AM +0100: > Ingo Schwarze wrote:
>> Why would you do something like that? >> Not sure whether is dangerous, but it doesn't feel useful either. >> I never heard of anybody doing something like that. > This is just part of my effort to learn UNIX. Oh, i see. Yes, experimentation can be useful for learning, as long as you are not doing it on a production machine. > I read that the user's home directory is determined by the settings > in /etc/passwd in the book UNIX made easy, so I wanted to try it out. I haven't heard about that particular book, but that doesn't inspire confidence in it. Yes, in the 1970ies, it did work like that, but the master.passwd(5) file format first appeared in 4.3BSD-Reno on 1986, so your book might either be almost 40 years out of date, or it's dumbing things down so much that they become outright incorrect. While master.passwd(5) is a typical BSD thing and other systems user other methods for similar purposes (for example, you might have heard about "shadow password" files), i doubt that may systems are still in use where directly editing /etc/passwd is still enough. Consequently, when reading that book, make sure to have an ample supply of salt at hand (at least as much as a moose would be willing to consume on a fine spring day). >> $ man master.passwd pwd_mkdb vipw > Thank you! I have looked through the manual pages and understand that > the key is the contents of /etc/master.passwd, which (ideally using > vipw) checks the modifications made and regenerates (using pwd_mkdb) > the contents of /etc/passwd. > > Now the new home directory setup for user2 is working! So /etc/passwd > is apparently only readable by the "public", the operating system > actually works with /etc/master.passwd - thanks a lot for the > directions!! >> Editing automatically generated files rarely ends well. > I will remember that and limit my playing accordingly. In principle, reading books and comparing to manual pages to see whether what they say is still correct, plus a bit of experimentation, is not a bad way to learn. For advanced users, reading source code is also recommended. Have fun! Ingo