use pubkey auth for containers
This commit is contained in:
parent
4ba2d0ce38
commit
3db1764a7f
3 changed files with 6 additions and 18 deletions
4
.bashrc
4
.bashrc
|
|
@ -92,7 +92,3 @@ if ! shopt -oq posix; then
|
||||||
. /etc/bash_completion
|
. /etc/bash_completion
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# use vim as default editor
|
|
||||||
export VISUAL=vim
|
|
||||||
export EDITOR="$VISUAL"
|
|
||||||
|
|
|
||||||
|
|
@ -14,22 +14,14 @@ function user_config {
|
||||||
if [[ "$USER" == "user" ]]; then
|
if [[ "$USER" == "user" ]]; then
|
||||||
get_path
|
get_path
|
||||||
mkdir $HOME/.vim
|
mkdir $HOME/.vim
|
||||||
if [[ -a $HOME/.bashrc ]]; then
|
ln -sf $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf,.profile} $HOME/;
|
||||||
mv $HOME/.bashrc $HOME/.bashrc.old
|
ln -sf $SCRIPTPATH/vim/colors $HOME/.vim/
|
||||||
echo "Old .bashrc moved to .bashrc.old"
|
|
||||||
fi
|
|
||||||
ln -s $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf,.profile} $HOME/;
|
|
||||||
ln -s $SCRIPTPATH/vim/colors $HOME/.vim/
|
|
||||||
echo 'Linking configuration files done'
|
echo 'Linking configuration files done'
|
||||||
elif [[ "$USER" == "root" ]]; then
|
elif [[ "$USER" == "root" ]]; then
|
||||||
get_path
|
get_path
|
||||||
mkdir /root/.vim
|
mkdir /root/.vim
|
||||||
if [[ -a $HOME/.bashrc ]]; then
|
ln -sf $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf,.profile} /root/
|
||||||
mv /root/.bashrc /root/.bashrc.old
|
ln -sf $SCRIPTPATH/vim/colors /root/.vim/
|
||||||
echo "Old .bashrc moved to .bashrc.old"
|
|
||||||
fi
|
|
||||||
ln -s $SCRIPTPATH/{.bashrc,vim/.vimrc,tmux/.tmux.conf,.profile} /root/
|
|
||||||
ln -s $SCRIPTPATH/vim/colors /root/.vim/
|
|
||||||
echo 'Linking configuration files done'
|
echo 'Linking configuration files done'
|
||||||
else
|
else
|
||||||
echo 'No selection was made'
|
echo 'No selection was made'
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ config_ssh() {
|
||||||
sed -i 's/^#Port .*/Port '"$PORT"'/' $CONTAINER_PATH/etc/ssh/sshd_config
|
sed -i 's/^#Port .*/Port '"$PORT"'/' $CONTAINER_PATH/etc/ssh/sshd_config
|
||||||
sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $CONTAINER_PATH/etc/ssh/sshd_config
|
sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $CONTAINER_PATH/etc/ssh/sshd_config
|
||||||
sed -i 's/^#PubkeyAuthentication .*/PubkeyAuthentication yes/' $CONTAINER_PATH/etc/ssh/sshd_config
|
sed -i 's/^#PubkeyAuthentication .*/PubkeyAuthentication yes/' $CONTAINER_PATH/etc/ssh/sshd_config
|
||||||
echo $SSHKEY >> $CONTAINER_PATH/root/.ssh/authorized_keys
|
cat $SSHKEY >> $CONTAINER_PATH/root/.ssh/authorized_keys
|
||||||
}
|
}
|
||||||
|
|
||||||
dotfiles() {
|
dotfiles() {
|
||||||
|
|
@ -54,7 +54,7 @@ if [ -n "$HOSTNAME" ] ;then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SSH_SERVER" == "y" ] ;then
|
if [ "$SSH_SERVER" == "y" ] ;then
|
||||||
read -e -p "Enter ssh key for ssh access: " SSHKEY
|
read -e -p "Enter ssh key for container access: " SSHKEY
|
||||||
config_ssh
|
config_ssh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue