我是 Kubuntu 11.10 机器上的系统管理员。我在哪里为新用户(比如属于“用户”组)配置基本配置?
编辑1:
我想配置语言 - 目前我的新用户可以使用英语和保加利亚语。我希望他们可以使用英语和俄语 - 并且将 Alt-CapsLock 设置为输入语言切换组合。
编辑2:
如何配置
/usr/share/kde4
当我做
kdesudo systemsettings
并保存配置 - 仅根设置发生了更改 - 而不是那些/usr/share/kde4
设置。
编辑3:
新用户获得/etc/skel
控制 bash 行为和外观的文件。那么 KDE 新用户的默认文件呢 - 它们存储在哪里?
编辑4:
哦,我发现了一些提示:
kde4-config --path config
给出了 KDE 查找配置的文件夹列表(以冒号分隔)。我的机器响应如下:
/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/
看起来第三行是 KDE 采用默认选项的地方。所以我找到了这些无数的设置 - 但没有 GUI 方式来配置它 ((。
编辑5:
最后,我创建了一个虚拟用户,并对其进行了配置,然后编写了一个脚本它将设置提供给指定用户。诀窍是将chown
点文件从一个用户转移到另一个用户。我已经测试过了 - 效果很好。
答案1
我已经写完了脚本它传输点文件,之后就chown
一切结束了。
编辑:
大约三年前,我用 bash 重写了这个脚本。而且我已经用这个脚本一段时间了。但是,我已经好几年没用过这个脚本了,也不再维护它了。我现在没有审查过这个脚本,但我认为它的质量不高,因为我很久以前就写了它。
基本思想是将基本的点文件存储在 github 上,并让脚本下载这些文件并修补用户名并分配适当的权限。
#!/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
答案2
/etc/skel 中的所有内容都会被复制,因此如果您包含.bashrc
或类似内容,它将被复制到新用户的主目录并成为新用户的设置。查看您自己的主目录中的隐藏文件,看看那里有什么。KDE 和大多数其他应用程序会将每个用户的设置放在那里。
ls -la /home/$(whoami)/