Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm a sys admin on Kubuntu 11.10 machine. Where do I configure the basic config for a new user (say belonging to group "users")?

Edit 1:

I want to configure langauages - currently my new users get English and Bulgarian Languages. I want them to get English and Russian - and also to set Alt-CapsLock - to be the input-language-switching-combination.

Edit 2:

How do I configure things in

/usr/share/kde4

When I do

kdesudo systemsettings

and save configurations - only root settings got changed - not the /usr/share/kde4 ones.

Edit 3:

New user gets the /etc/skel files controlling bash behaviour-appearence. What about the KDE new user's default files - where are they stored?

Edit 4:

Oh, I found some hints:

kde4-config --path config

gives a list of folders (separated by the colon) where KDE looks for configs. My machine responded with:

/home/boris/.kde/share/config/
/etc/kde4/
/usr/share/kubuntu-default-settings/kde4-profile/default/share/config/
/usr/share/kde4/config/
/usr/share/desktop-base/profiles/kde-profile/share/config/

It looks like third line is where KDE takes the default options. So I found these zilions of settings - but no GUI way to configure it ((.

Edit 5:

Finally, I've created a dummy user, configured it, and wrote a script which gives it's settings to a given user(s). The trick - is to chown after one transfered the dot files from one user to another. I've tested it - it works fine.

share|improve this question
1  
Could you please edit your question to specify what settings they are exactly that you want to configure? –  nitstorm Mar 2 '12 at 13:55

2 Answers 2

Everything in /etc/skel is copied, so if you include a .bashrc or likewise it will be copied to the new user's home directory and become the new user's settings. Take a look through the hidden files of your own home directory and see what's there. KDE and most other applications will place per-user settings there.

ls -la /home/$(whoami)/
share|improve this answer
up vote 0 down vote accepted

I've ended writing a script which transfers dot files, and after that chowns it all.

Edit:

I re-wrote this script in bash about three years ago. And I had been using this one for some time. However, I haven't used this script in years, and don't maintain this script anymore. I didn't reviewed this script now, but I would imagine it is not of high quality, given that I wrote it long time ago.

The basic idea is to store basic dot files on github, and make script download these and patch the username and assign proper permissions.

#!/bin/bash
# to get description use the -h flag

# You can see the structure of this code in emacs. For that eval the
# following lines:
# (mapc
#  (lambda (language-mode-hook)
#    (add-hook language-mode-hook 
#              (lambda ()
#                (make-local-variable 'outline-regexp)
#                (setq outline-regexp "^## ")
#                (make-local-variable 'outline-heading-end-regexp)
#                (setq outline-heading-end-regexp ":\n")
#                (outline-minor-mode 1))))
#    '(shell-script-mode-hook sh-mode-hook))
# this makes use of outline-minor-mode and the default keys are:
# C-c @ C-t    show top level structure
# C-c @ C-a    show all
# for more see the Outline menu.

# TODO:
# update routine documntation?

# exit after a single error:
set -e

# ===========
## preambula:

PROGNAME=${0##*/}
PROGVERSION=4.02
NoColors=false

Dependencies=false
Root=false
Internet=false
Localhost=false
Base=`logname`
Update=false
Source=boris
Autostart=false

usage()
{
cat << EO
Usage: $PROGNAME <user>

This script install bkubuntu kubuntu set of programs and settings. It
assumes the user have x86_64 archeticture.

It does back-up all the configs, but it keeps only the latest back-up
-- so if You'll run this script twice in a row -- You'll lose Your
files. You might want to back up the original thing manually.

All of the options except for -u/--update require root privilages.

Examples
========

To install bkubuntu for Yourself::

    cd /path/to/bkubuntu.bash 
    sudo ./bkubuntu.bash -i

To install Your bkubuntu to root::

    cd /path/to/bkubuntu.bash
    sudo ./bkubuntu.bash -r

To install bkubuntu from other user at localhost::

    cd /path/to/bkubuntu.bash
    sudo ./bkubuntu.bash -l -s <that user>

To update Your bkubuntu::

    bkubuntu.bash -u # provided bkubuntu.bash is in the PATH

Add -a if You want to have emacs, firefox, krusader, libreoffice
quickstart to run at start-up.

Options
=======

EO
cat << EO | column -s\& -t

  -i, --internet & fetchs bkubuntu from the internet and installs it for the current user
  -l, --localhost & fetchs bkubuntu from other user (-s)
  -a, --autostart & also turn on the autostart script (starts emacs, firefox, krusader at start up)
 
  -s, --source & source repository user, default to $Source
  -u, --update & updates Your bkubuntu git repos from the internet (should not be done under sudo)
  -r, --root & transfers subset of Your bkubuntu to the root
 
  -h, --help & show this output
  -v, --version & show version information
      --no-colors & disables coloring in output
EO
}


SHORTOPTS="hvars:ilu"
LONGOPTS="help,version,no-colors,autostart,root,source:,internet,localhost,update"

ARGS=$(getopt -s bash --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@")
eval set -- "$ARGS"

while true; do
    case $1 in

        -a|--autostart)
            Autostart=true;;
        -r|--root)
            Root=true;;
        -s|--source)
            Source=$2; shift;;
        -i|--internet)
            Internet=true;;
        -l|--localhost)
            Localhost=true;;
        -u|--update)
            Update=true;;

        -h|--help)
            usage; exit 0;;
        -v|--version)
            echo "$PROGVERSION"; exit 0;;
           --no-colors)
            NoColors=true;;
        --)
            shift; break;;
        *)
            shift; break;;
    esac
    shift
done

if $NoColors; then
    BLUE=''
    GREEN=''
    RED=''
    BLACK=''
else
    BLUE='\033[94m'
    GREEN='\e[0;32m'
    RED='\033[91m'
    BLACK='\033[0m'
fi


# ===========
## functions:

autostart () {
    if [ -e /home/$Base/.kde/Autostart/bkubuntu_startup_simple.bash ]; then
        rm /home/$Base/.kde/Autostart/bkubuntu_startup_simple.bash
    fi
    if ! [ -d /home/$Base/.kde/Autostart ]; then
        mkdir /home/$Base/.kde/Autostart
    fi
    ln /home/$Base/cmp/devs/bk_automates/bkubuntu/bk_runs_at/bkubuntu_startup_simple.bash /home/$Base/.kde/Autostart/bkubuntu_startup_simple.bash
}


back-up_and_clean () {
    if [ -d "$Base~" ]; then
        rm -rf "$Base~"
    fi
    mkdir "$Base~"

    mv -T $Base "$Base~"
    mkdir $Base
    cd $Base

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with backing up $Base (to $Base~).${BLACK}"
}


rebase () {

    # these files should have ho spaces!
    FILES="\
$PWD/.kde/share/config/plasma-desktoprc
$PWD/.kde/share/config/plasma-desktop-appletsrc
$PWD/.kde/share/apps/kfileplaces/bookmarks.xml
$PWD/.kde/share/config/krusaderrc
$PWD/.kde/share/apps/krusader/krbookmarks.xml
$PWD/.kde/share/apps/krusader/useractions.xml
$PWD/.kde/share/apps/krusader/krusaderui.rc
$PWD/.config/libreoffice/3/user/registrymodifications.xcu
$PWD/.kde/share/apps/kfileplaces/bookmarks.xml
$PWD/.kde/share/config/khotkeysrc
$PWD/.thunderbird/n8fe137g.default/secmod.db
$PWD/.thunderbird/n8fe137g.default/prefs.js
$PWD/.thunderbird/n8fe137g.default/extensions.ini
$PWD/.thunderbird/n8fe137g.default/extensions.sqlite
$PWD/.thunderbird/n8fe137g.default/panacea.dat
$PWD/.thunderbird/n8fe137g.default/startupCache/startupCache.8.little
$PWD/.mozilla/firefox/kkhrci0w.default/secmod.db
$PWD/.mozilla/firefox/kkhrci0w.default/prefs.js
$PWD/.mozilla/firefox/kkhrci0w.default/extensions.ini
$PWD/.mozilla/firefox/kkhrci0w.default/search.json
$PWD/.mozilla/firefox/kkhrci0w.default/extensions.sqlite
$PWD/.mozilla/firefox/kkhrci0w.default/startupCache/startupCache.8.little
$PWD/.mozilla/firefox/kkhrci0w.default/zotero/locate/engines.json"

    # root doesn't have all these files:
    if [ $Base = "root" ]; then
        FILES=`echo $FILES | perl -pe 's/ /\n/g' | perl -pe 's/.*(emacs|libreoffice|autokey|bkubuntu|mozilla|thunderbird).*//' | perl -pe 's/^\n//'`
    fi

    for fileName in $FILES; do
        sed -i "s/$Source/$Base/g" "$fileName"
    done

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with rebasing.${BLACK}"

}


chown_logout () {

    # ------
    # chown:

    chown -R $Base $PWD
    echo -e "${RED}${PROGNAME}: ${GREEN}chown: everything went fine.\n    You may wish to restart now.${BLACK}"
    sleep 1

    # ---------------
    # finally logout:

    secsTilLogout=10
    while [ $secsTilLogout -gt 0 ]; do
        sleep 1 &
        clear
        echo -e "${RED}${PROGNAME}: ${GREEN}Done. Documentation for hotkeys is available at:\n    ~/bks/computer/HotKeyPoetry/index.html\n\n    Unless You kill me with Ctrl-c --\n    I'll logout computer in $secsTilLogout seconds.${BLACK}"
        secsTilLogout=$(( $secsTilLogout - 1 ))
        wait # the point of 'sleep 1 & -- wait' construct is not to take into account the time of `sleep' execution
    done

    qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout 0 0 0

}


# ==========
## internet:

if $Internet; then

    # -------------
    # adding repos:

    echo -e \\n | sudo add-apt-repository ppa:kubuntu-ppa/ppa
    echo -e \\n | sudo add-apt-repository ppa:kubuntu-ppa/backports

    echo -e \\n | add-apt-repository ppa:cassou/emacs

    wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
    # perhaps I should add 
    # deb http://download.virtualbox.org/virtualbox/debian precise contrib
    # to /etc/apt/sources.list

    wget -q "http://deb.playonlinux.com/public.gpg" -O- | apt-key add -
    wget http://deb.playonlinux.com/playonlinux_squeeze.list -O /etc/apt/sources.list.d/playonlinux.list

    apt-get update

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with repos.\n    Now the back-up phase...${BLACK}"
    sleep 1

    # -----------
    # installing:

    echo -e \\n | apt-get install emacs-snapshot konsole krusader okular kolourpaint4 smplayer vlc audacious gwenview k3b synaptic kopete keepassx xclip firefox thunderbird procps tree xsel libreoffice wmctrl git virtualbox playonlinux build-essential kubuntu-restricted-extras gfortran parallel sshfs ssh

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with installing prerequisites.\n    Now the cloning stage...${BLACK}"
    sleep 1


    # --------------------
    # preparing the place:

    cd /home
    back-up_and_clean

    # -----------------
    # clonning configs:

    git clone https://github.com/bk322/bk_dots .
    cp -R .bkubuntu/* . # copying dir structure
    git clone https://github.com/bk322/bk_automates /home/$Base/cmp/devs/bk_automates

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with cloning configs.${BLACK}"
    sleep 1

    # parallel:
    # dpkg -i /home/$Base/cmp/repo/parallel*.deb


    # -----------------
    # applying configs:

    # autostart?
    if $Autostart; then
        autostart
    fi

    # ----------
    # XULRunner:

    mv /home/$Base/cmp/repo/.mozilla .
    mv /home/$Base/cmp/repo/.thunderbird .

    rebase
    chown_logout

fi


# =========
## copying:

if $Localhost; then

    cd /home
    back-up_and_clean

    # ----------------------------------
    # cloning configs from user $Source:

    cd /home/$Base
    git clone /home/$Source .
    cp -R .bkubuntu/* . # copying dir structure
    git clone /home/$Source/cmp/devs/bk_automates /home/$Base/cmp/devs/bk_automates

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with cloning configs from $Source.${BLACK}"
    sleep 1

    # -----------------
    # applying configs:

    # autostart?
    if $Autostart; then
        autostart
    fi

    # ----------
    # XULRunner:

    mv /home/$Base/cmp/repo/.mozilla .
    mv /home/$Base/cmp/repo/.thunderbird .

    # -----------------------
    # rebase, chown, restart:

    rebase
    chown_logout

fi


# ==========
## updating:

if $Update; then

    # -------------
    # update repos:

    cd /home/$Base
    git checkout -- . && git pull -u origin master

    cd /home/$Base/cmp/devs
    git checkout -- . && git pull -u origin master

    cd /home/$Base
    echo -e "${RED}${PROGNAME}: ${GREEN}Done with syncing gits.${BLACK}"
    sleep 1

    # ---------
    # rebasing:
    rebase

fi

# ======
## root:

if $Root; then

    cd /
    Base=root
    back-up_and_clean

    Source=`logname`
    cd /home/$Source
    listOfFiles=`git ls-files | perl -pe 's/.*(libreoffice|autokey|bkubuntu|mozilla|thunderbird).*//' | perl -pe 's/^\n//'`
    for File in $listOfFiles; do
        Parents=${File#/home/$Source/}
        cp --parents "$Parents" /root
    done


    # -----------------------
    # rebase, chown, restart:

    cd /root
    rebase
    chown_logout

fi
share|improve this answer
    
@Sneetsher: see edit. –  Adobe Jul 18 at 11:47
    
This is great. It will be helpful for coming users –  Sneetsher Jul 18 at 11:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.