-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
111 lines (80 loc) · 2.62 KB
/
start.sh
File metadata and controls
111 lines (80 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
###############
# RUN AS A ROOT #
###############
SUDO_USER="foo"
SOME_USER="bar"
#PUBLIC_KEY="ssh-rsa AAAA ... rsa-key-foo"
apt install curl htop vim mc
apt update && apt upgrade
adduser $SUDO_USER
usermod -aG sudo $SUDO_USER
mkdir $HOME/.ssh
#echo $PUBLIC_KEY > $HOME/.ssh/authorized_keys
touch $HOME/.ssh/authorized_keys
chmod go-w $HOME $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys
chown $WHOAMI $HOME/.ssh/authorized_keys
systemctl restart sshd
echo -e "syntax on\n set autoindent\n set background=dark\n set incsearch\n set hlsearch" >> $HOME/.vimrc
echo "alias l.='ls -d .* --color=auto'
#alias subdomainFoo='cd /var/www/html/sub.domain.com'
#alias exampleFoo='cd /var/www/html/example.com'
alias ports='netstat -tulanp'
alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..' ">> $HOME/.bashrc
source $HOME/.bashrc
#Install 2FA
apt install libpam-google-authenticator && google-authenticator
echo "auth [success=done default=ignore] pam_succeed_if.so user ingroup without-otp" >> /etc/pam.d/sshd
echo "auth required pam_google_authenticator.so" >> /etc/pam.d/sshd
# DO NOT CHANGE THE SEQUENCE OF ABOVE LINES
sed -i 's/UsePAM no/UsePAM yes/' /etc/ssh/sshd_config
sed -i 's/\(ChallengeResponseAuthentication\) no/\1 yes/g' /etc/ssh/sshd_config
systemctl restart sshd.service
groupadd without-otp
usermod -a -G without-otp $SOME_USER
service sshd restart
#Install ffsend
cd $HOME
wget https://github.com/timvisee/ffsend/releases/download/v0.2.58/ffsend-v0.2.58-linux-x64-static
mv ./ffsend-* ./ffsend
chmod a+x ffsend
mv ./ffsend /usr/local/bin/
mkdir /backup/
#curl https://rclone.org/install.sh | sudo bash
#rclone config
echo "#!/bin/bash
mkdir -p /backup/from_root
rm /backup/starszy/*
mv /backup/nowszy/* /backup/starszy/
cp -aR -- .config /root/backup/from_root
cp -aR -- /root/.[bglmnpsvw]* /backup/from_root/
TIME=$(date +"%m-%d-%Y")
FILENAME=backup-root-$TIME.tar.gz
SRCDIR=/backup/from_root/
DESDIR=/backup/new/
tar -cvpzf $DESDIR/$FILENAME $SRCDIR
FILENAME=backup-etc-$TIME.tar.gz
SRCDIR=/etc/
DESDIR=/backup/new/
tar -cvpzf $DESDIR/$FILENAME $SRCDIR
FILENAME=backup-var-www--$TIME.tar.gz
SRCDIR=/var/www/
DESDIR=/backup/new/
tar -cvpzf $DESDIR/$FILENAME $SRCDIR
FILENAME=backup-var-log-$TIME.tar.gz
SRCDIR=/var/log/
DESDIR=/backup/new/
tar -cvpzf $DESDIR/$FILENAME $SRCDIR
rm -rf /backup/from_root/.[^.]*
#rclone copy /backup/new/ mega:server --buffer-size 0M" > /root/backup.sh
chmod +x backup.sh
# Add it to cron:
# 00 04 * * * /bin/sh /root/backup.sh
#
echo "PROMPT_COMMAND='history -a; history -n'" >> $HOME/.bashrc