When I create a new user, how do I tell Ubuntu not to create a Public
sub-folder?
Ubuntu – How to make the public folder not appear in the home folder of new accounts
configurationhome-directoryusersxdg
Related Question
- Ubuntu – Why isn’t the new “postgres” user I created showing up in User Accounts
- Ubuntu – How to delete a user & its home folder safely
- Ubuntu – Automatically create folder in new users’ home directory
- Ubuntu – How to create new user with Public key authentication
- Ubuntu – Moving home folder to new installation of Ubuntu
- Ubuntu – How are the default user folders in the home created for a new user
Best Answer
Preventing the creation of content folders
As you may have noticed, Ubuntu has a few "special" folders for certain types of content.
These will appear in new user accounts, and auto-recreate (in certain situations) for existing users. However, this behavior can be configured.
For new users
Open
/etc/xdg/user-dirs.defaults
in your preferred text editor, with administrator privileges. You will see something close to this:This is a system description of the default content folders to create for new users. If you replace any directory here with the home folder, new users will not have that folder created on first login.
For example, to prevent new users from getting a Public folder:
For existing users
Use the same process as above, but edit the
.config/user-dirs.dirs
in the user's home folder instead. This method does not require administrative privileges, and will prevent content directories from being recreated after user deletion.Technical reading