zshrc and some resilliencey and fixing ssh key login
This commit is contained in:
55
newSrv.sh
55
newSrv.sh
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
# Standard strict mode and error handling boilderplate...
|
# Standard strict mode and error handling boilderplate...
|
||||||
|
|
||||||
set -eEu
|
#set -e
|
||||||
set -o pipefail
|
#set -o pipefail
|
||||||
set -o functrace
|
#set -o functrace
|
||||||
|
|
||||||
# Start actual script logic here...
|
# Start actual script logic here...
|
||||||
|
|
||||||
@ -21,6 +21,12 @@ fi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export SUBODEV_CHECK
|
||||||
|
SUBODEV_CHECK="$(getent passwd|grep -c subodev)"
|
||||||
|
|
||||||
|
export LOCALUSER_CHECK
|
||||||
|
LOCALUSER_CHECK="$(getent passwd|grep -c localuser)"
|
||||||
|
|
||||||
|
|
||||||
function global-configureAptRepos()
|
function global-configureAptRepos()
|
||||||
|
|
||||||
@ -58,8 +64,10 @@ function global-profileScripts()
|
|||||||
|
|
||||||
echo "Now running $FUNCNAME...."
|
echo "Now running $FUNCNAME...."
|
||||||
|
|
||||||
curl --silent https://dl.knownelement.com/FetchApplyDistPoint/profiled-tsys-shell.sh > /etc/profile.d/tsys-shell.sh
|
#curl --silent https://dl.knownelement.com/FetchApplyDistPoint/profiled-tsys-shell.sh > /etc/profile.d/tsys-shell.sh
|
||||||
curl --silent https://dl.knownelement.com/FetchApplyDistPoint/profiled-tmux.sh > /etc/profile.d/tmux.sh
|
#curl --silent https://dl.knownelement.com/FetchApplyDistPoint/profiled-tmux.sh > /etc/profile.d/tmux.sh
|
||||||
|
|
||||||
|
curl --silent https://dl.knownelement.com/FetchApplyDistPoint/tsys-zshrc > /etc/zshrc
|
||||||
|
|
||||||
echo "Completed running $FUNCNAME"
|
echo "Completed running $FUNCNAME"
|
||||||
|
|
||||||
@ -109,24 +117,33 @@ if [ ! -d $ROOT_SSH_DIR ]; then
|
|||||||
&& chown root: /root/.ssh/authorized_keys
|
&& chown root: /root/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d $LOCALUSER_SSH_DIR ]; then
|
if [ "$LOCALUSER_CHECK" = 1 ]; then
|
||||||
if [ ! -d /home/subodev ]; then
|
|
||||||
mkdir -p /home/localuser/.ssh/
|
chsh -s "$(which zsh)" localuser
|
||||||
curl --silent http://dl.knownelement.com/FetchApplyDistPoint/ssh-authorized-keys > /home/localuser/.ssh/authorized_keys \
|
|
||||||
&& chmod 400 /home/localuser/.ssh/authorized_keys \
|
if [ ! -d $LOCALUSER_SSH_DIR ]; then
|
||||||
&& chown localuser: /home/localuser/.ssh/authorized_keys
|
mkdir -p /home/localuser/.ssh/
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
curl --silent https://dl.knownelement.com/FetchApplyDistPoint/ssh-authorized-keys > /home/localuser/.ssh/authorized_keys \
|
||||||
|
&& chown localuser /home/localuser/.ssh/authorized_keys \
|
||||||
|
&& chmod 400 /home/localuser/.ssh/authorized_keys
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SUBODEV_CHECK" = 1 ]; then
|
||||||
|
|
||||||
|
chsh -s "$(which zsh)" subodev
|
||||||
|
|
||||||
if [ ! -d $SUBODEV_SSH_DIR ]; then
|
if [ ! -d $SUBODEV_SSH_DIR ]; then
|
||||||
if [ ! -d /home/subodev ]; then
|
|
||||||
mkdir /home/subodev/.ssh/
|
mkdir /home/subodev/.ssh/
|
||||||
curl --silent http://dl.knownelement.com/FetchApplyDistPoint/ssh-authorized-keys > /home/subodev/.ssh/authorized_keys \
|
fi
|
||||||
&& chmod 400 /home/subodev/.ssh/authorized_keys \
|
|
||||||
&& chown subodev: /home/subodev/.ssh/authorized_keys
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
curl --silent https://dl.knownelement.com/FetchApplyDistPoint/ssh-authorized-keys > /home/subodev/.ssh/authorized_keys \
|
||||||
|
&& chmod 400 /home/subodev/.ssh/authorized_keys \
|
||||||
|
&& chown subodev: /home/subodev/.ssh/authorized_keys
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Completed running $FUNCNAME"
|
echo "Completed running $FUNCNAME"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
|
|||||||
PROMPT_EOL_MARK=""
|
PROMPT_EOL_MARK=""
|
||||||
|
|
||||||
# configure key keybindings
|
# configure key keybindings
|
||||||
bindkey -e # emacs key bindings
|
bindkey -v # emacs key bindings
|
||||||
bindkey ' ' magic-space # do history expansion on space
|
bindkey ' ' magic-space # do history expansion on space
|
||||||
bindkey '^U' backward-kill-line # ctrl + U
|
bindkey '^U' backward-kill-line # ctrl + U
|
||||||
bindkey '^[[3;5~' kill-word # ctrl + Supr
|
bindkey '^[[3;5~' kill-word # ctrl + Supr
|
||||||
@ -48,8 +48,8 @@ zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
|||||||
|
|
||||||
# History configurations
|
# History configurations
|
||||||
HISTFILE=~/.zsh_history
|
HISTFILE=~/.zsh_history
|
||||||
HISTSIZE=1000
|
HISTSIZE=10000
|
||||||
SAVEHIST=2000
|
SAVEHIST=200000
|
||||||
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||||
setopt hist_ignore_dups # ignore duplicated commands history list
|
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||||
setopt hist_ignore_space # ignore commands that start with space
|
setopt hist_ignore_space # ignore commands that start with space
|
||||||
|
Reference in New Issue
Block a user