################
#!/bin/sh #
#171207 #
#Script Adduser#
################
echo -n “Masukkan Username = “;
read nama
echo -n “Masukkan Nama Lengkap = “;
read namalengkap
echo “Add User”
/usr/sbin/useradd -c”$namalengkap” $nama
echo “Masukkan Password 2x yah..”
/usr/bin/passwd $nama
———————–
#######################
#!/bin/sh #
#171207 #
#Script Add IP Address#
#######################
echo “Example Interface = eth0″;
echo -n “Interface = “;
read interface
echo -n “Masukkan IP Address = “;
read ip
echo -n “Masukkan Subnetmask = “;
read subnetmask
echo -n “Masukkan Default Gateway = “;
read gateway
echo -n “Masukkan DNS Server = “;
read dns
echo “Add IP Address”;
/sbin/ifconfig -a $interface $ip $netmask
echo “Add Default Gateway”;
/sbin/route add default gw $gateway
echo “Add DNS Server”;
echo “nameserver $dns” > /etc/resolv.conf
——————————
##############################
#!/bin/sh #
#171207 #
#Script Add Virtual Interface#
##############################
echo “Example Interface Virtual = eth0:1″;
echo -n “Interface Virtual= “;
read interface
echo -n “Masukkan IP Address = “;
read ip
echo -n “Masukkan Subnetmask = “;
read subnetmask
echo “Add Interface Virtual”
/bin/touch /etc/sysconfig/network-scripts/ifcfg-$interface
echo “DEVICE=$interface” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “ONBOOT=yes” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “BOOTPROTO=static” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “IPADDR=$ip” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “NETMASK=$subnetmask” >> /etc/sysconfig/network-scripts/ifcfg-$interface
echo “Restart Service Network”;
/etc/init.d/network restart
———————————–
###################################
#!/bin/sh #
#171207 #
#Script Transparant Proxy #
###################################
echo -n “Masukkan source ‘IP/NETMASK’ =”;
read source
echo -n “Masukkan Destination ‘IP/NETMASK’ =”;
read destination
echo -n “Masukkan Protocol =”;
read protocol
echo -n “Masukkan Destination Port =”;
read dport
echo -n “Masukkan Redirect Port =”;
read redirect
echo “Create redirect rule”
/sbin/iptables -t nat -I PREROUTING -s $source -d $destination -p $protocol –dport $dport -j REDIRECT –to-port $redirect
/sbin/iptables -t nat -I POSTROUTING -s $source -o etho -j MASQUERADE
Labels: Simple Bash Script