1
0
Fork 0

add pwgen

This commit is contained in:
VirtuBox 2019-08-15 00:07:59 +02:00
parent 730424f5aa
commit 3f4cf44cfd
Signed by: virtubox
GPG Key ID: 22EB296C97BAD476
1 changed files with 19 additions and 8 deletions

View File

@ -2,7 +2,7 @@
# FUNCTIONS
if [ -f $HOME/.mybashrc/custom ]; then
. $HOME/.mybashrc/custom
. $HOME/.mybashrc/custom
fi
if [ "$(id -u)" != "0" ]; then
IS_SUDOERS=$(groups | grep sudo)
@ -92,7 +92,6 @@ ffmpeg_start_time() {
echo ""
echo "example : ffmpeg-cut-start 00:34:24.85 file.mp4 300"
else
FFMPEG_ARGS="$1 -i \"$2\""
if [ -n "$3" ]; then
FFMPEG_ARGS="$FFMPEG_ARGS -time $3 -c copy -movflags +faststart ${2%.mp4}-output.mp4"
@ -105,7 +104,7 @@ ffmpeg_start_time() {
RANDOM_GIT_COMMIT() {
[ ! -x /usr/bin/w3m ] && {
[ -z "$(command -v w3m)" ] && {
apt-get install -y w3m
}
@ -310,7 +309,7 @@ _NGINX_EE() {
_INSTALL_NODEJS() {
if [ -n "$1" ]; then
wget -O nodejs.sh https://deb.nodesource.com/setup_${1}.x
wget -O nodejs.sh https://deb.nodesource.com/setup_"$1".x
else
wget -O nodejs.sh https://deb.nodesource.com/setup_10.x
fi
@ -471,10 +470,14 @@ _APT_BIONIC_KERNEL() {
}
_FTP_ADD() {
ftpaccountpass="$(date +%s | sha256sum | base64 | head -c 32)"
echo "$ftpaccountpass"
sudo adduser --home /var/www/mz-mz.net/htdocs --shell /bin/false --ingroup www-data "$1"
if [ "$#" = "0" ] || [ "$#" = "1" ]; then
echo "Usage : ftpadd <user> <domain>"
else
ftpaccountpass=$(_PWGEN)
echo "$ftpaccountpass"
$NEED_SUDO useradd -d /var/www/"$2"/htdocs -M -s /bin/false -G www-data "$1"
echo "$1:$ftpaccountpass" | $NEED_SUDO chpasswd -m
fi
}
_UFW_MINIMAL() {
@ -511,6 +514,13 @@ _SSH_SECURE() {
fi
}
_PWGEN() {
if [ -z "$(command -v pwgen)" ]; then
apt install pwgen -assume-yes
fi
pwgen -s 24 1
}
# enable color support of ls and also add handy aliases
# some more ls aliases
#alias wp='/usr/bin/wp --allow-root'
@ -577,3 +587,4 @@ alias apt-repo-ubuntu=_APT_REPO_UBUNTU
alias apt-bionic-kernel=_APT_BIONIC_KERNEL
alias ufw-minimal=_UFW_MINIMAL
alias ssh-secure=_SSH_SECURE
alias passwdgen=_PWGEN