1

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?

Dana the Sane
  • 828
  • 10
  • 19

1 Answers1

1

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

Dana the Sane
  • 828
  • 10
  • 19
Tim
  • 3,017
  • 17
  • 15
  • 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 '12 at 18:22
  • Glad to help ;) – Tim Jan 27 '12 at 18:23
  • 1
    One addition to the answer Tim posted: I had to use sudo under an admin account to avoid getting a permission error. Once I did that, though, it worked like a charm. Thanks! –  Jun 14 '12 at 05:50