I had Ubuntu-14.04 installed in a minimum configuration, i.e. with no X Windows support. Later I added x-server packages for my card, and a lightweight WindowManager (I don't want KDE or GNOME), so I normally launch X with startx, however someone keeps on creating Documents, Desktop, Download, Video, Music etc. directories in my $HOME. I thought this isually done by "advanced" desktop environments. What application/daemon can be behind this anyways?
Who is creating Documents/Video/Pictures/etc. in home directory
homexdgxdg-user-dirs
Related Solutions
You can just temporarily displace them.
cd ~
mkdir .trash
find . ! -name . -prune ! -type d -atime +365 -exec \
sh -c 'touch -a -- "$@"
mv -- "$@" ~/.trash
' -- {} +
That will find all files in your $HOME
directory - without recursing into child directories - which have not been accessed for a year. It will update the access time for all of them to right now, and then move all of them into a directory named .trash
. If you encounter any problems between the time you run it and whatever time you decide to start deleting old files in ~/.trash
then you can try moving some of them back and see if any of those you put in the trash were the cause.
Most dot files have a name that resembles the application that uses it. Unsurprisingly, .gnupg
is used by GnuPG. GnuPG (also known as GPG) is a program that encrypts and signs files. As soon as you invoke it for the first time, it will create a .gnupg
directory in your home directory and a few files in it. This directory contains a lot of private information (e.g. who your contacts are), so it's accessible only to the owner. This could happen, for example, if someone sends you a signed email; if your email client supports PGP email then it will attempt to verify the signature (and fail since you don't have the sender's public key in your GPG keyring).
The real question here is why this directory in your home directory is owned by root. The answer is that you ran GPG as root, but with HOME
set to your own home directory. Or, more precisely, you ran a program which ran GPG under the hood. One such program is APT: package management tools (apt-get
, apt
, aptitude
, etc.) use GPG to verify that the packages that you download are genuine. If you ran something like sudo apt-get install SOMEPACKAGE
, this would create a .gnupg
directory in your home directory, since sudo
doesn't change the home directory by default.
The fix is to remove the .gnupg
directory, then create it under your user. You can just remove the root-owned directory (sudo rm -r ~/.gnupg
): any file under your home directory is fair game for you. You could alternatively move it to root's home directory (sudo mv ~/.gnupg /root
), but it doesn't contain anything important anyway. Then run a GPG command such as gpg --list-keys
; this will populate your ~/.gnupg
directory with empty keyring files.
Just entering a directory is always harmless. Listing files and viewing their content is usually harmless, but it can be harmful in some configurations because terminals parse escape sequences in what applications print. Under Linux, plain ls
or ls -l
is fine but ls -N
is potentially risky. Plain cat filename
is risky but less filename
is fine (whereas less +R filename
is risky). In the .gnupg
directory, there's nothing harmful.
Best Answer
This is carried out by the
xdg-user-dirs-update
1 package.The file
/usr/bin/xdg-user-dirs-update
is run at logon and creates the files based on defaults in/etc/xdg/user-dirs.defaults
, or if it exists$HOME/.config/user-dirs.dirs
.If you want to disable it, the setting is in
/etc/xdg/user-dirs.conf
, or uninstall the package, if dependencies allow.1: The package name above is for Ubuntu. On Fedora and Arch it is
xdg-user-dirs
.