Sunday, April 28, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 1103  / 1 Year ago, mon, march 27, 2023, 7:14:00

When I create a new user, how do I tell Ubuntu not to create a Public sub-folder?


More From » configuration

 Answers
5

Preventing the creation of content folders



As you may have noticed, Ubuntu has a few "special" folders for certain types of content.



Special directories



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:



XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"


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:



XDG_PUBLICSHARE_DIR="$HOME"


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




  1. The XDG User Directories specification

  2. "How can I change the default location of content directories in my home folder?"


[#41789] Monday, March 27, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
onbean

Total Points: 29
Total Questions: 102
Total Answers: 115

Location: Benin
Member since Fri, Mar 24, 2023
1 Year ago
onbean questions
Fri, Mar 18, 22, 19:49, 2 Years ago
Tue, Dec 6, 22, 11:51, 1 Year ago
Mon, Jun 7, 21, 17:21, 3 Years ago
Mon, Jan 16, 23, 04:48, 1 Year ago
Mon, Oct 17, 22, 14:51, 2 Years ago
;