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?
First run
dscl . -read /Users/$USERNAME
Find the entry for
NFSHomeDirectory
, should read likeNFSHomeDirectory: /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