53 lines
1.5 KiB
Bash
Executable File
53 lines
1.5 KiB
Bash
Executable File
#!/bin/bash -
|
|
#
|
|
#===================================================================================
|
|
#
|
|
# Copyright Beijing Linx Technology Co., Ltd. 2010年09月21日
|
|
#
|
|
# Filename: conf_sshd.sh
|
|
#
|
|
# USAGE: ./conf_sshd.sh
|
|
#
|
|
# Description: configure sshd,to achieve remote installation
|
|
#
|
|
# Version: 0.1
|
|
# Created: 2010年09月21日
|
|
#
|
|
# Author: Hu Gang
|
|
#
|
|
# ChangeLog: 1. 2010年09月21日 Create.
|
|
#
|
|
#===================================================================================
|
|
#
|
|
#===================================================================================
|
|
#Performance function
|
|
#===================================================================================
|
|
startnetwork(){
|
|
local networkfile='/etc/sysconfig/network-devices/ifcfg-eth0'
|
|
echo 'enter your IP:'
|
|
read ip
|
|
echo 'enter your netmask:'
|
|
read netmask
|
|
echo 'enter your gateway:'
|
|
read gateway
|
|
sed -i "s%IPADDR=.*%IPADDR=${ip}%g" $networkfile
|
|
sed -i "s%NETMASK=.*%NETMASK=${netmask}%g" $networkfile
|
|
sed -i "s%GATEWAY=.*%GATEWAY=${gateway}%g" $networkfile
|
|
ifup eth0
|
|
}
|
|
|
|
startsshd(){
|
|
sed -i "s%^#shm%shm%g" /etc/fstab
|
|
mount -a
|
|
mkdir -p /var/empty
|
|
openssh-keygen
|
|
/usr/sbin/sshd -o X11Forwarding=yes
|
|
}
|
|
|
|
#===================================================================================
|
|
#Execution
|
|
#===================================================================================
|
|
startnetwork
|
|
startsshd
|
|
|