75 lines
1.3 KiB
Bash
Executable file
75 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
echo "hostname"
|
|
read -p "enter name" name
|
|
if [[ -n $name ]]; then
|
|
hostnamectl set-hostname $name
|
|
exec bash
|
|
fi
|
|
echo "enter enp0s3"
|
|
read enp0s3
|
|
if [[ -n $enp0s3 ]]; then
|
|
read -p "enter gateway" gat
|
|
read -p "enter dns" dns
|
|
cat > /etc/NetworkManager/system-connections/enp0s3.nmconnection << EOF
|
|
[connnection]
|
|
id=enp0s3
|
|
uuid=$(uuidgen)
|
|
tipe=ethernet
|
|
autoconnect-priority=-999
|
|
interface-name=enp0s3
|
|
timestamp=$(date +%s)
|
|
|
|
[ethernet]
|
|
|
|
|
|
[ipv4]
|
|
address1=$enp0s3
|
|
dns=$dns
|
|
gateway=$gat
|
|
method=manual
|
|
|
|
[ipv6]
|
|
addr-gen-mode=eui64
|
|
method=disabled
|
|
|
|
[proxy]
|
|
|
|
EOF
|
|
|
|
chmod 600 /etc/NetworkManager/system-connections/enp0s3.nmconnection
|
|
fi
|
|
read -p "Reboot?" o
|
|
if [[ -n $o ]]; then
|
|
reboot
|
|
fi
|
|
|
|
echo "enter accaunt"
|
|
read -p "continue: " can
|
|
if [[ -n $can ]]; then
|
|
useradd -u 2026 remote_user
|
|
passwd remote_user
|
|
cat >> /etc/sudoers << EOF
|
|
remote_user ALL=(ALL)NOPASSWD:ALL
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
read -p "ftp?: " ftp
|
|
read -p "enter ip: " ip
|
|
if [[ -n $ftp ]]; then
|
|
iptables -I INPUT -p tcp --match multiport --dports 21,22,20000:25000 -j ACCEPT
|
|
iptables -t nat -A POSTROUTING -p tcp -d $ip --dport 21 -j MASQUERADE
|
|
iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 21 -j DNAT --to-destination $ip:21
|
|
service iptables save
|
|
|
|
cat >> /etc/vsftpd/vsftpd.conf << EOF
|
|
pasv_min_port=20000
|
|
pasv_max_port=25000
|
|
pasv_enable=YES
|
|
|
|
EOF
|
|
chmod 600 /etc/vsftpd/vsftpd.conf
|
|
fi
|
|
|