I'm configuring a OS X Lion based ftp/sftp server, and I want the user for file transfers to land in a specific directory upon login. I'm not sure if it's a good idea to meddle with the home directory as I'm unsure if the absence of directories like ~/Library will cause problems. Unlike Linux, OS X doesn't store the base dir in /etc/passwd for all users.

Does anyone know how to alter the base dir for a user?

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

First run dscl . -read /Users/$USERNAME

Find the entry for NFSHomeDirectory, should read like NFSHomeDirectory: /Users/$USERNAME.

To change the entry:

dscl . -change /Users/$USERNAME NFSHomeDirectory $OLD_USER_HOME $NEW_USER_HOME

Works for shell logins, you may need to copy files from old home dir to the new home dir to allow GUI logins.

Reference: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/dscl.1.html

link|improve this answer
Perfect, it's fine if the path doesn't change for GUI logins. I just had to add the record_path to -change to get the 2nd command working. Thanks! – Dana the Sane Jan 27 at 18:22
Glad to help ;) – Tim Jan 27 at 18:23
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.