统信UOS_麒麟KYLINOS设置用户模板

226 篇文章 2 订阅
226 篇文章 4 订阅

原文链接:统信UOS/麒麟KYLINOS设置用户模板
hello,大家好啊,今天给大家带来一篇关于修改用户模板的文章,结合我们之前制作ISO镜像及制作云桌面用户模板的文章,可以一同使用。本篇文章对用户模板的五个方面进行了设置,都是一些很简单的操作,大家可以根据示例进行延伸操作,本文只是提供一种思路,包括给新创建的用户桌面自动添加文件、自动开启某项服务、设置bash的相关变量、设置用户的环境变量等,大家可以根据实际情况结合示例进行改动。

1、查看系统信息

pdsyw@pdsyw-PC:~/Desktop$ cat /etc/os-version 
[Version] 
SystemName=UOS Desktop
SystemName[zh_CN]=统信桌面操作系统
ProductType=Desktop
ProductType[zh_CN]=桌面
EditionName=Professional
EditionName[zh_CN]=专业版
MajorVersion=20
MinorVersion=1060
OsBuild=11014.100.100
pdsyw@pdsyw-PC:~/Desktop$ 
pdsyw@pdsyw-PC:~/Desktop$ uname -a
Linux pdsyw-PC 4.19.0-arm64-desktop #6030 SMP Tue Jun 27 15:28:10 CST 2023 aarch64 GNU/Linux
pdsyw@pdsyw-PC:~/Desktop$ 

image.png

2、查看当前用户pdsyw下的目录内容
image.png

3、进入到/etc/skel目录,以管理员身份打开
image.png

4、输入密码
image.png

5、测试一:对Desktop目录做模板设置
image.png

5.1、使用图形化的方式,进入Desktop目录,创建一个pdsyw.doc文件
image.png

5.2、使用命令的方式

pdsyw@pdsyw-PC:~/Desktop$ sudo -i
请输入密码:
验证成功
root@pdsyw-PC:~# 
root@pdsyw-PC:~# cd /etc/skel/Desktop/
root@pdsyw-PC:/etc/skel/Desktop# touch pdsyw.doc
root@pdsyw-PC:/etc/skel/Desktop# ls -ltr
总用量 16
-rw-r--r-- 1 root root 15360 11月 20 14:08 pdsyw.doc
root@pdsyw-PC:/etc/skel/Desktop# 

image.png

5.3、在控制中心添加用户
image.png

5.4、添加pdsyw2用户
image.png

5.5、切换用户
image.png

5.6、使用pdsyw2用户登录
image.png

5.7、桌面上已经有了pdsyw.doc文件
image.png

6、点击设置
image.png

7、勾选显示隐藏文件
image.png

8.1、测试二:对.config文件做设置
image.png

8.2、进入.config/autostart目录
image.png

8.3、在启动器中将浏览器发送到当前用户pdsyw的桌面
image.png

8.4、复制桌面上的浏览器
image.png

8.5、粘贴到.config/autostart目录下
image.png

8.6、粘贴后的内容
image.png

8.7、通过命令演示操作

root@pdsyw-PC:~# cd /etc/skel/.config/autostart/
root@pdsyw-PC:/etc/skel/.config/autostart# 
root@pdsyw-PC:/etc/skel/.config/autostart# cp /usr/share/applications/org.deepin.browser.desktop ./
root@pdsyw-PC:/etc/skel/.config/autostart# 
root@pdsyw-PC:/etc/skel/.config/autostart# ls -ltr
总用量 16
-rw-r--r-- 1 root root  336 5月  26 15:52 dde-first-run.desktop
-rw-r--r-- 1 root root 9398 11月 20 14:10 org.deepin.browser.desktop
root@pdsyw-PC:/etc/skel/.config/autostart# 

image.png

8.8、创建pdsyw3用户
image.png

8.9、使用pdsyw3用户登录后,浏览器自动打开
image.png

9.1、测试三:对.bashrc文件做设置
image.png

9.2、.bashrc未修改前的内容

root@pdsyw-PC:/etc/skel# cat .bashrc 
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    #alias grep='grep --color=auto'
    #alias fgrep='fgrep --color=auto'
    #alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
# Set LS_COLORS environment by Deepin
if [[ ("$TERM" = *256color || "$TERM" = screen* || "$TERM" = xterm* ) && -f /etc/lscolor-256color ]]; then
    eval $(dircolors -b /etc/lscolor-256color)
else
    eval $(dircolors)
fi

9.3、打开.bashrc文件,末尾添加echo “pdsyw”
image.png

9.4、使用命令操作

root@pdsyw-PC:~# cd /etc/skel/
root@pdsyw-PC:/etc/skel# vi .bashrc 
root@pdsyw-PC:/etc/skel# cat  .bashrc  | grep pdsyw
echo "pdsyw"
root@pdsyw-PC:/etc/skel# 

image.png

9.5、添加pdsyw4用户
image.png

9.6、使用pdsyw4用户登录系统打开终端后显示pdsyw
image.png

10.1、测试四:对.bash_logout做设置
image.png

10.2、打开.bash_logout文件,末尾添加echo “bye pdsyw”
image.png

10.3、使用命令操作

root@pdsyw-PC:/etc/skel# vi .bash_logout 
root@pdsyw-PC:/etc/skel# 
root@pdsyw-PC:/etc/skel# cat .bash_logout 
# ~/.bash_logout: executed by bash(1) when login shell exits.

# when leaving the console clear the screen to increase privacy

if [ "$SHLVL" = 1 ]; then
    [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

echo "bye pdsyw"
root@pdsyw-PC:/etc/skel# 

image.png

10.4、添加pdsyw6用户
image.png

10.5、通过ssh连接pdsyw6,退出后显示bye pdsyw

pdsyw@pdsyw-PC:~/Desktop$ ssh pdsyw6@localhost 
pdsyw6@localhost's password: 
验证成功
Welcome to UnionTech OS Desktop 20 Professional

homepage:https://www.chinauos.com/

bugreport:https://bbs.chinauos.com/
pdsyw
pdsyw6@pdsyw-PC:~$ exit
注销
bye pdsyw
Connection to localhost closed.
pdsyw@pdsyw-PC:~/Desktop$ 

image.png

11.1、测试五:对.profile文件做设置
image.png

11.2、在.profile文件底部添加内容
image.png

11.3、通过命令操作

root@pdsyw-PC:/etc/skel# vi .profile 
root@pdsyw-PC:/etc/skel# 
root@pdsyw-PC:/etc/skel# cat .profile  | grep dde
#cp $HOME/.config/dde-printer.ini to desktop
if [ -f "$HOME/.config/dde-printer.ini" ] ; then
    cp $HOME/.config/dde-printer.ini $HOME/Desktop/
root@pdsyw-PC:/etc/skel# 

image.png

11.4、修改后的 .profile文件

root@pdsyw-PC:/etc/skel# cat .profile 
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

#cp $HOME/.config/dde-printer.ini to desktop
if [ -f "$HOME/.config/dde-printer.ini" ] ; then
    cp $HOME/.config/dde-printer.ini $HOME/Desktop/
fi
root@pdsyw-PC:/etc/skel# 

11.5、创建pdsyw7用户
image.png

11.6、使用pdsyw7用户登录后桌面有dde-printer.ini文件
image.png

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鹏大圣运维

编写不易,还请支持

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值