Default folders in linux

How can I change the default location of content directories (eg Pictures, Templates, Music) in my home folder?

I have multiple users on my home desktop. I am content with most of the default user directories, however I would like to make one change. I would like to setup a common directory for Music (ie /home/common/Music/ ) that is writable to all users and Nautilus/Dolphin/whatever recognizes as the user’s Music directory. I know that it would involve changing the xdg user directory setup, but everything I see points that it is relative to the user’s $HOME . Is there a way I can specify an absolute path?

2 Answers 2

Yes to do what you need you simply need to change the xdg configuration for each existing user like so:

XDG_DESKTOP_DIR="$HOME/Desktop" . XDG_MUSIC_DIR="/home/common/Music" XDG_VIDEOS_DIR="$HOME/Movies" 

And to make this something available to all users created simply edit this:

DESKTOP=Desktop . MUSIC=../common/Music VIDEOS=Videos 

To modify the permissions, this bit is tricky because you need to make sure that all files created in these directories remain editable by everyone. I found this interesting guide on the subject:

Which suggests doing the following to make the permissions sticky as well as adding the users all to a common group:

chown nobody:users /home/common chmod 2775 /home/common usermod -a -G users user1 

You may want to change the umask setting to allow all files created to be modifiable by the anyone in the users group in that directory, edit /etc/profile and go to the bottom and change umask 022 to umask 002 This is considered secure since all users have their own primary user and really only effects shared directories like this one you want to make.

Let us know if it works well enough.

Источник

Linux directory structure: /home and /root folders

The Linux Juggernaut

This is our 6th post on understanding first level directories in /. Knowing these folders in detail or at least what each is meant for will help you understand Linux/Unix in whole. we already covered below directories, please have a look at those to understand them. In this post we will see two more directories ie /home and /root directory. These directories are meant for similar purpose. The /root is meant for just root user and /home is for all the remaining users.

A brief intro to /home directory in Linux/Unix

The /home directory is a place where by default all user home directories are created.

OK, what are user home directories for?

These directories are a kind of personal place(Working space) for all the users other than root. There will be a separate folder for each user in /home directory. For example if you have a user called ‘Tom’, then his default home directory is /home/tom. We can change this default folder when creating user in Linux. Our Tom user can do what ever he wants in /home/tom folder where he have full rights on the files he created and owned in that folder.

Читайте также:  Web hacking with kali linux

The properties of /home folder?

1) A separate sub folder ie /home/ is present for each user.
2) Only user who owns this sub folder can access it’s content other than root user. So, tom user can not access Barbi user home directory content which is located at /home/barbi.
3) All his terminal properties, command history file, application setting files(~/.vimrc, ~/.ssh) etc everything is located in this folder.
4) System admins when try to implement quota for users they will implement it on /home directory. This /home directory should be mounted on a separate partition.

Each user home directory is important and frequently used directory for that user, we have alias name for it. This alias is set to ~ so that when ever user wants to navigate to his home directory, he do not have to use /home/ but just use below short cuts.

Will take you to your home directory.

When you are in your home directory even our PS1 prompt will show user’s home directory with ~.

xyz@sanne-taggle:/home$ cd xyz@sanne-taggle:~$ pwd /home/xyz

Some of the important files which are present in /home/ or /root directory are as below.

1) Bash shell related configuration files.
.bashrc
.bash_history
.bash_profile
.bash_logout

If your shell is not bash then you should see other shell configuration files.

2) Default editor configuration files.
3) You secure shell configuration files are located in ~/.ssh which contain your ssh-keys, knownhosts etc.

How about /root directory in Linux?

This is root’s home directory. Do not get confused between / and /root. Both these are meant for different purpose.

/ is the main folder where your file system resides, where as /root is root user home directory. Similar to /home/, root user saves his personal data, terminal configurations in /root directory.

Some FAQ on user home directories

Why is home directory of root is a separate folder?

Because of security reasons root’s home directory is separated from /home.

I see many users in /etc/passwd but I don’t see them in /home, why?

This can be of two reasons.
1) Either users are system defined users
2) Or users home directory resides some where else.
3) Or intentionally /home directory is not created. For this type of users / will be treated as their home directory. This is a nightmare as he can not do anything in / folder due to lack of permissions.

In our next post we will see lib folder.

Читайте также:  Как выключить компьютер линукс терминал

Surendra Anne

Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.

Latest posts by Surendra Anne (see all)

  • Docker: How to copy files to/from docker container — June 30, 2020
  • Anisble: ERROR! unexpected parameter type in action: Fix — June 29, 2020
  • FREE: JOIN OUR DEVOPS TELEGRAM GROUPS — August 2, 2019
  • Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) — August 27, 2018
  • How to use ohai/chef-shell to get node attributes — July 19, 2018

Источник

Change default user folders path?

In previous releases of Ubuntu, I used Ubuntu Tweak to change the paths to the user folders (Music, Documents, Videos, etc). I can’t find an option in Gnome 3 to do this, and Ubuntu Tweak’s ppa still has no version for Oneiric.

3 Answers 3

Open a terminal and write this command:

Each row is a user folder definition (music, video. ), edit as you want. For example, I did not want the videos folder in home, but in a separate disk, and changed the XDG_VIDEOS_DIR parameter this way:

XDG_VIDEOS_DIR="/media/share/Video" 

OR simply run:

xdg-user-dirs-update --set VIDEOS "/media/share/Video" 

Logout and login back to effect properly.

after i restart or unplug my external disk the folders disappear from that list. any idea how to solve that? askubuntu.com/questions/251624/…

From the manual for xdg-user-dirs-update I’m guessing that it goes back to the default directories if they exist, so just delete them and it should be good

@ArthurSpoon Unfortunately, no, this (e.g. deleting ~/Documents) doesn’t stop the overwriting of the tweaked user-dirs.dirs file.

As at today (7 years later!), my experiments seem to show:

  1. These variables are set in the file ~/.config/user-dir.dirs relate to XDG, which stands for «X Desktop Group». i.e. they appear to relate to the «windowing» processes. But for example, none of these variables are then accessible by the user (or root) as an environment variable
  2. It appears that the variable XDG_DOCUMENTS_DIR is the one which is responsible, in Nemo, for giving one particular directory a «special» icon
  3. That’s what we’re all bothered about: how to give one particular directory a special icon all to itself, signifying «this is your DOCUMENTS directory»
  4. To give this to a particular directory other than ~/Documents ,
    — a. make a link from the directory you want under «My Computer» in the LH panel of Nemo
    — b. change the value of the XDG_DOCUMENTS_DIR variable in ~/.config/user-dir.dirs to this directory, using an absolute path.
    — c. log out and back in: whatever its name may be, in both the LH and RH side of Nemo your directory should now have the «special» DOCUMENTS icon!
Читайте также:  Настройка ssh соединения linux

NB it is not sufficient, as suggested in a comment above, simply to delete the ~/Documents directory for everything to work OK. Bear in mind in particular that, if at startup it is found that the XDG_DOCUMENTS_DIR path actually doesn’t lead to a valid directory, the setting for XDG_DOCUMENTS_DIR will be overwritten in user-dir.dirs , replacing it, in principle, with $HOME/Documents . (in fact, oddly, my experiments seem to find that it is usually replaced with $HOME , for some inexplicable reason).

NB2 as an alternative to the above (especially if the «special» icon doesn’t matter in particular to you), you could use a symlink . which you can call «Documents». In fact, you could have both: a symlink and a special icon for your target file.

NB3 I don’t believe you can make a symlink as suggested . AND give it a special DOCUMENTS icon! But given this, all seems to be about cosmetics anyway maybe it, um, doesn’t matter much!

Источник

Using or deleting default directories in /home

I just migrated from windows to ubuntu. I noticed that in /home/[user]/ , there are directories like Documents , Music etc. On windows, these were unusable because many programs would just dump configuration files, screenshots and the likes into these folders. Will programs on ubuntu also access these folders? What would be the implications of adapting them for daily use or straight up deleting them?

They are used by the graphical file managers like Nautilus. See also this: askubuntu.com/questions/67044

Don’t worry, Ubuntu doesn’t do that. I would suggest, before start making complicated changes, that you familiarize on this structure. You are the «owner» of these folders, and only you can decide what data goes into them.

2 Answers 2

Several applications use these folders as default locations for files, but you can always reconfigure that in the application. For example image viewers will look for images in Images , audio players will look for music files in Music , Firefox will save downloaded files to Downloads etc. Also it should be noted that the built-in screenshot feature (PrtSc key) dumps screenshot images right into the Images folder.

Myself I use these folders according to their intended purpose, ie. keep my documents in Documents , video files in Videos etc. I even have created multiple subfolders within them. Have no issues with that.

No configuration files are stored in these folders. In Linux, configuration is kept in hidden files or hidden folders («hidden» in Linux means that the file or folder name starts with a dot, while in Windows hidden files are indicated by a special «hidden» attribute, not by name) within user’s home directory. Most of the config is kept in subfolders within .config folder, but some applications have their own locations — for example Firefox keeps configuration in .mozilla folder, and if you install Zoom, it will keep it’s configuration and temporary working data in .zoom folder.

Источник

Оцените статью
Adblock
detector