From 733bddf3eb33a8b67305c9b47b264d1c5c2744cb Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 2 May 2021 14:04:27 +0200 Subject: [PATCH] add_new_user.sh: add user 'andreas' (Guenzler -Kanzlei Kreuzbergstrasse). --- add_new_user.sh | 6 + .../user_templates/andreas/.bash_logout | 7 + .../user_templates/andreas/.bashrc | 124 +++++++++++++ .../user_templates/andreas/.profile | 33 ++++ .../andreas/.ssh/authorized_keys | 1 + supported-files/user_templates/andreas/.vimrc | 173 ++++++++++++++++++ 6 files changed, 344 insertions(+) create mode 100644 supported-files/user_templates/andreas/.bash_logout create mode 100644 supported-files/user_templates/andreas/.bashrc create mode 100644 supported-files/user_templates/andreas/.profile create mode 100644 supported-files/user_templates/andreas/.ssh/authorized_keys create mode 100644 supported-files/user_templates/andreas/.vimrc diff --git a/add_new_user.sh b/add_new_user.sh index c72c7a0..f8ab3fa 100755 --- a/add_new_user.sh +++ b/add_new_user.sh @@ -200,6 +200,12 @@ if $password_needed ; then perl -i -n -p -e "s#^(${user_name}):[^:]+:(.+)#\1:\\\$6\\\$a/PWqRoP\\\$bQs3qmthLdL6nVVt65ml6XcZqfVxQ9nQg0/VcUjuh44vuVlJ7lGgvb6Zv1MM.Ryu1Qis1a3GFuKIRww3p7RVJ.:\2#" /etc/shadow + # - andreas (guenzler) + # - + elif [[ "$user_name" = 'andreas' ]]; then + perl -i -n -p -e "s#^(${user_name}):[^:]+:(.+)#\1:\\\$6\\\$x1OiWj0IJSm7hvIt\\x1OiWj0IJSm7hvIt$SWEah9JdlhZnMZ9ZhViwS9VoLEBAdokpjFPmkZSvdzdQXe4bNKEIOXzEhHKdA8vUYZ7UGjRkcLBEiZ6LClcOS.$:\2#" /etc/shadow + + # - wadmin # - elif [[ "$user_name" = 'wadmin' ]]; then diff --git a/supported-files/user_templates/andreas/.bash_logout b/supported-files/user_templates/andreas/.bash_logout new file mode 100644 index 0000000..de4f5f7 --- /dev/null +++ b/supported-files/user_templates/andreas/.bash_logout @@ -0,0 +1,7 @@ +# ~/.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 diff --git a/supported-files/user_templates/andreas/.bashrc b/supported-files/user_templates/andreas/.bashrc new file mode 100644 index 0000000..080da51 --- /dev/null +++ b/supported-files/user_templates/andreas/.bashrc @@ -0,0 +1,124 @@ +# ~/.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) 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 +__hostname="$(hostname -f)" +__hostname="${__hostname%.*}" +__hostname="${__hostname%.*}" +if [ "$color_prompt" = yes ]; then + #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@${__hostname}:\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' + PS1='${debian_chroot:+($debian_chroot)}\u@${__hostname}:\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 + +# some more ls aliases +alias ll='ls -l' +alias la='ls -A' +alias l='ls -CF' + +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' + +# 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 + +export EDITOR=vim + +## - set beep more quiet +## - +#xset b 10 500 50 diff --git a/supported-files/user_templates/andreas/.profile b/supported-files/user_templates/andreas/.profile new file mode 100644 index 0000000..9d7fc10 --- /dev/null +++ b/supported-files/user_templates/andreas/.profile @@ -0,0 +1,33 @@ +# ~/.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 +umask 0002 + +# 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 + +# this is for the midnight-commander +# to become the last directory the midnight commander was in +# as the current directory when leaving the midnight commander +# +#. /usr/lib/mc/bin/mc.sh +if [ -f '/usr/share/mc/bin/mc.sh' ] ; then + source /usr/share/mc/bin/mc.sh +fi + diff --git a/supported-files/user_templates/andreas/.ssh/authorized_keys b/supported-files/user_templates/andreas/.ssh/authorized_keys new file mode 100644 index 0000000..b9d5d13 --- /dev/null +++ b/supported-files/user_templates/andreas/.ssh/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD5C7LKB1Lx1n7V4uBCv6/r6vnLeFitpIeLRIKiU5iykbCqP9ItbYhDMlH4Ad60J1ZGE3up1AdMyR160bELC17lvRuHKZYk92IOHYe/qWNnrb8cbd0+Lj2cpOE6Wa3Dhc1bY19vNq3NpZM21qgZOmlyKhIXzF6EvRLGYTLHy1MsfRIOL1VilmS4JZvcDkoNKEbKeMJrBTmqA1Bf15kEqN1dK7YgNA2f+gkgyDd7GbxqMdeQfkOLbvviM1WI24PyfbTjbVFtDpuKPqlWDkYcK1SUjmXDaIezbpp0wP+WVyls70XqU20S2eYx+5UN3rok7k9mmuoCJAaJUvPbhRP50MdcEMQEfGiinqZc7+LI7/W+vZzCYTKgJOyl0MKBDlLSSA/lqAgakS/HYgjret6UO6GFFdWhe8ab4zmXY8SLiCCqs1jXE+5AjXKAxYCYGoAq2GhP3ca76PiUhQkpTRAialdU199IBtk5+L9qIT+nWOp0dDEVc06Hy/Mkm+SefW6Q3WSjfSMeoAlXUcpZ7wzzyGNlzDNUNw/tfMicWhI6/ch/49YDO1baHXsEVIqH+kfeP2qr3Mi5al3pNXgduUI6KnWXP6qr/4zeUGOWlDLgcBzj3mdf0gfQnke3VdBZqa/B4sBcg9PkkBcI2c2yuZqO1ZT9g+T4BcH2Z1VXpnrtuUO7pw== andreas@pc102 diff --git a/supported-files/user_templates/andreas/.vimrc b/supported-files/user_templates/andreas/.vimrc new file mode 100644 index 0000000..0bf54d9 --- /dev/null +++ b/supported-files/user_templates/andreas/.vimrc @@ -0,0 +1,173 @@ +" An example for a vimrc file. +" +" Maintainer: Bram Moolenaar +" Last change: 1999 Sep 09 +" +" To use it, copy it to +" for Unix and OS/2: ~/.vimrc +" for Amiga: s:.vimrc +" for MS-DOS and Win32: $VIM\_vimrc + +" This line should not be removed as it ensures that various options are +" properly set to work with the Vim-related packages available in Debian. +runtime! debian.vim + +set nocompatible " Use Vim defaults (much better!) +set bs=2 " allow backspacing over everything in insert mode +set ai " always set autoindenting on +" set backup " keep a backup file +"set viminfo='20,\"50 " read/write a .viminfo file, don't store more + " than 50 lines of registers +set viminfo='20,\"50,:20,%,n~/.viminfo +set history=50 " keep 50 lines of command line history +set ruler " show the cursor position all the time +set ignorecase " suchen case-insenitiv +set showmatch " zeige passende klammern +set shell=/bin/bash " shell to start with ! +set expandtab " tabs --> blanks +set showmode " anzeige INSERT/REPLACE/... + +" set smartcase " Do smart case matching + +set incsearch " Incremental search + " Start searching when you type the first character of + " the search string. As you type in more characters, the + " search is refined. + +set t_Co=256 " To enable 256 colors in vim, put this your .vimrc before setting the colorscheme + +" einrueckung +set shiftwidth=3 +set tabstop=3 +" Round indent to multiple of 'shiftwidth' for > and < commands +set shiftround + +" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries +" let &guioptions = substitute(&guioptions, "t", "", "g") + +" Don't use Ex mode, use Q for formatting +map Q gq + +" Make p in isual Visual mode replace the selected text with the "" register. +vnoremap p :let current_reg = @"gvdi=current_reg + +" Switch syntax highlighting on, when the terminal has colors +" Also switch on highlighting the last used search pattern. +if &t_Co > 2 || has("gui_running") + syntax on + set hlsearch +endif + +" Only do this part when compiled with support for autocommands. +if has("autocmd") + +" In text files, always limit the width of text to 78 characters + autocmd BufRead *.txt set tw=78 + + augroup cprog + " Remove all cprog autocommands + au! + + " When starting to edit a file: + " For C and C++ files set formatting of comments and set C-indenting on. + " For other files switch it off. + " Don't change the order, it's important that the line with * comes first. + autocmd FileType * set formatoptions=tcql nocindent comments& + autocmd FileType c,cpp set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,:// + augroup END + + augroup gzip + " Remove all gzip autocommands + au! + + " Enable editing of gzipped files + " set binary mode before reading the file + autocmd BufReadPre,FileReadPre *.gz,*.bz2 set bin + autocmd BufReadPost,FileReadPost *.gz call GZIP_read("gunzip") + autocmd BufReadPost,FileReadPost *.bz2 call GZIP_read("bunzip2") + autocmd BufWritePost,FileWritePost *.gz call GZIP_write("gzip") + autocmd BufWritePost,FileWritePost *.bz2 call GZIP_write("bzip2") + autocmd FileAppendPre *.gz call GZIP_appre("gunzip") + autocmd FileAppendPre *.bz2 call GZIP_appre("bunzip2") + autocmd FileAppendPost *.gz call GZIP_write("gzip") + autocmd FileAppendPost *.bz2 call GZIP_write("bzip2") + + " After reading compressed file: Uncompress text in buffer with "cmd" + fun! GZIP_read(cmd) + let ch_save = &ch + set ch=2 + execute "'[,']!" . a:cmd + set nobin + let &ch = ch_save + execute ":doautocmd BufReadPost " . expand("%:r") + endfun + + " After writing compressed file: Compress written file with "cmd" + fun! GZIP_write(cmd) + if rename(expand(""), expand(":r")) == 0 + execute "!" . a:cmd . " :r" + endif + endfun + + " Before appending to compressed file: Uncompress file with "cmd" + fun! GZIP_appre(cmd) + execute "!" . a:cmd . " " + call rename(expand(":r"), expand("")) + endfun + + augroup END + + " This is disabled, because it changes the jumplist. Can't use CTRL-O to go + " back to positions in previous files more than once. + if 0 + " When editing a file, always jump to the last cursor position. + " This must be after the uncompress commands. + autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif + endif + +endif " has("autocmd") + +" toggle syntax highlighting +map :if exists("syntax_on") syntax off else syntax on endif +map :nohls + +" use to toggle line numbers +nmap :set number! + + +" If using a dark background within the editing area and syntax highlighting +" turn on this option as well +set background=dark + + +" set color for search +hi clear search +hi search term=bold,reverse cterm=bold,reverse gui=bold,reverse + +" set color for Comment +hi clear Comment +"highlight Comment term=bold cterm=bold ctermfg=LightBlue guifg=#80a0ff gui=bold +"highlight Comment term=none cterm=none ctermfg=LightBlue guifg=#80a0ff gui=bold +"highlight Comment term=bold cterm=bold ctermfg=grey guifg=#80a0ff gui=bold +highlight Comment term=none cterm=none ctermfg=grey guifg=#80a0ff gui=bold +"highlight Comment term=none cterm=none ctermfg=177 guifg=#80a0ff gui=bold +"highlight Comment term=none cterm=none ctermfg=215 guifg=#80a0ff gui=bold + +" Go back to the position the cursor was on the last time this file was edited +au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")|execute("normal `\"")|endif + +" visual shifting (does not exit Visual mode) +vnoremap < >gv + +" Scroll when cursor gets within 3 characters of top/bottom edge +set scrolloff=3 + +" Show line, column number, and relative position within a file in the status line +" set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] +"set statusline=\ %F\ %(\|\ flags:\ %R%M%H%W\ %)%(\|\ type:\ %Y\ %)%(\|\ format:\ %{&ff}\ %)%(\|\ syntax:\ %{synIDattr(synID(line('.'),col('.'),0),'name')}%)\ \ %=line:\ %l/%L\ \|\ column:\ %c%V\ \|\ relative\:\ %p%%\ +set statusline=\ %F\ %(\|\ flags:\ %R%M%H%W\ %)%(\|\ type:\ %Y\ %)%(\|\ format:\ %{&ff}\ %)\ \ %=line:\ %l/%L\ \|\ col:\ %c%V\ \|\ %p%% +" Always show status line, even for one window +set laststatus=2 +highlight StatusLine cterm=none ctermfg=white ctermbg=blue +