0

I want to perform some configuration tasks for a brand new user, like applying default settings.

For example, I would like to create some default directories (Documents, Downloads, Music, Pictures and Videos, just like in Windows) using translated names via xdg-user-dir (so, for a Brazilian user, he or she would actually get directories named Documentos, Downloads, Músicas, Imagens and Vídeos). That could be achieved using with commands like those on a shell script:

music="`xdg-user-dir MUSIC 2>/dev/null`"
if test -z "$music"; then
    music=$HOME/Music
fi
mkdir -p "$music"

I'm using openSUSE Leap 42.1 with KDE Plasma 5.4.2.

On the old but gold openSUSE 13.2, I could do that kind of configuration using the script /usr/share/kde4/env/startkde.suse.sh, as you can see here:

https://github.com/openSUSE/kdebase-opensuse/blob/master/config-files/usr/share/kde4/env/startkde.suse.sh

Additionally, LiveCD user specific settings could be done using the scripts in /usr/share/opensuse-kiwi/live_user_scripts/. That is still possible with openSUSE Leap 42.1. Example:

https://github.com/openSUSE/kdebase-opensuse/blob/master/config-files/usr/share/opensuse-kiwi/live_user_scripts/kde4.sh

But I want, if possible, to create those directories for every new created user, both LiveCD users and/or users created for an usual Linux installation on a hard drive.

Is there any way I can achieve that through a shell script or config file? I don't mind a solution bound to KDE Plasma 5 or openSUSE, as long as I achieve the desired effect. Thank you in advice!

2 Answers 2

3

For a default skeleton of home dir, in linux you have "/etc/skel/" dir.

Some snippets from here:

The /etc/skel directory contains files and directories that are automatically copied over to a new user's home directory when such user is created by the useradd program.

/etc/skel allows a system administrator to create a default home directory for all new users on a computer or network and thus to make certain that all users begin with the same settings or environment.

This is from a rhel7 clone:

# ls -la /etc/skel/
total 28
drwxr-xr-x.   2 root root  4096 Apr  1  2015 .
drwxr-xr-x. 140 root root 12288 Nov  6 11:52 ..
-rw-r--r--.   1 root root    18 Mar  6  2015 .bash_logout
-rw-r--r--.   1 root root   193 Mar  6  2015 .bash_profile
-rw-r--r--.   1 root root   231 Mar  6  2015 .bashrc

You can add anything you want here and it will be copied to every new users home directory

0

I am not on Suse, but the packages "xdg-user-dirs" and "xdg-user-dirs-gtk" seem to be what ou are looking for.

Solution from here:

https://forums.opensuse.org/showthread.php/477147-Adding-users-what-creates-their-default-subdirectories-%28Suse-11-4%29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .