changing my hostname?

Phil Meyer pmeyer at themeyerfarm.com
Thu Jun 28 17:13:03 UTC 2007


Kevin Kempter wrote:
> Hi List;
>
> Where do I change the hostname for a machine running Fedora 7?
>
>   

---cut---
#!/bin/sh

user=`id -u`

if [ $user != 0 ]
        then
        echo "Must be root to execute:  $0"
        exit
fi

HOST=`hostname`

echo -n "Enter the new Host Name:  "
read garb

echo "g/${HOST}/s//${garb}/g
w
q
" > /tmp/doed

list="/etc/hosts /etc/sysconfig/network 
/etc/sysconfig/network-scripts/ifcfg-eth?"

for name in $list
do
        echo "editing $name"
        ed $name < /tmp/doed
        hostname $garb
done
---cut---




More information about the fedora-list mailing list