Linux server branding

This is quite a noob info for people who try to resell servers.
When you are reselling servers, you want to replace source company address by your address. What to edit?

List server speciffication, test network speed:
ls -lt / /root;sleep 4;clear;hostname;cat /etc/red*;uname -a;sleep 3;mv /etc/resolv.conf /etc/resolv2.conf;echo -e "nameserver 8.8.8.8\nnameserver 8.8.4.4" > /etc/resolv.conf;cat /etc/resolv.conf;sleep 3;ping google.com -c 3;sleep 4;w;echo "CPU name: $( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo )";echo "CPU frequency: $( awk -F: ' /cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo )Mhz x $( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo ) cores";echo "Total RAM: $( free -m | awk 'NR==2 {print $2}' )";echo "Total SWAP: $( free -m | awk 'NR==4 {print $2}' )";sleep 6;lsblk -io KNAME,TYPE,SIZE,MODEL;df -h;sleep 6;cat /proc/mdstat;sleep 6;free -m;sleep 6;smartctl -H /dev/sda;sleep 6;smartctl -a /dev/sda;echo "Testing DL speed from Cachefly:";wget -O /dev/null http://cachefly.cachefly.net/100mb.test;echo "Change password? -> passwd";echo "Delete secure log & history?";echo "rm -f messages-* cron-* maillog-* secure-* ~/.viminfo /var/log/http*/*log;>/var/log/messages;>/var/log/maillog;>/var/log/cron;>/var/log/secure;history -c;echo >~/.bash_history;echo >/var/log/wtmp; echo > /var/log/btmp;>/var/log/lastlog;"
To change hostname at dedicated server, login via SSH (Command line interface - CLI), you can try software called PuTTY.

Then do command: hostname to learn your current one, then do hostname newhostname

vi /etc/hosts
vi /etc/hostname
vi /etc/sysconfig/network
/etc/init.d/network restart (or: service networking --full-restart )

Some guide: OVH : ChangeServerName

Another files which may contain identifiable texts of company you are reselling:
postfix/main.cf
resolvconf/resolv.conf.d/original
resolv.conf
resolf.conf is how to setup networking on linux server, add:
search google.com
nameserver 8.8.8.8
nameserver 8.8.4.4

and
/etc/init.d/network restart


vim /etc/postfix/main.cf - what is the use of this file? Its mail file, can i edit it?

Search in files content:
grep -rl "STRING THAT YOU WANT" *

Clear acess logs of Ubuntu/CentOS server + command line history:

cd /var/log;rm -rf audit;rm -f dmesg.*;rm -f messages-* cron-* maillog-* secure-* ~/.viminfo /var/log/http*/*log;[ -f auth.log ]&&>auth.log;[ -f messages ]&&>messages;[ -f maillog ]&&>maillog;[ -f cron ]&&>cron;[ -f secure ]&&>secure;[ -f wtmp ]&&>wtmp;[ -f btmp ]&&>btmp;[ -f dmesg ]&&>dmesg;[ -f lastlog ]&&>lastlog;[ -f syslog ]&&>syslog;[ -f lynis.log ]&&>lynis.log;[ -f fail2ban.log ]&&>fail2ban.log;>~/.bash_history;history -c;

==================================

A message from Server4You

"How i can brand it to me, so i can sell it to some custommer while he not knowing im reselling your server?"
There should only be a few occurrences of server4you.net. Most if not all will occur in /etc. You can replace all occurrences automatically, off the top of my head, using a combination of "find" "xargs" and "sed"

" Also when i did traceroute on server, the serverhostname.server4you.net appeared, which i dont want to happen too."
Please see our last response:
i believe you mean the reverse dns, you can change that from your customer interface under Network >> Nameserver >> Reverse DNS.

---- Command to recursively replace hostname in /etc directory ----- (Not tried, be carefull)

Replace all occurances of oldstring with newstring in all files in current directory and its subdirectories?

find . -name '*' -type f -print0 | xargs -0 sed -i 's|oldhostname|newhostname|g'
above dont works when dot in phrasse?

Automated proces of replacing default server hostnameDO:

Use your CLI (command line), SSH:

cd /etc;vim search.sh
(will create new file in /etc dir and open it) Then add following code into that file (copy there and then in Putty or similar SSH client do "A" key to enter editing mode. Then right mouse click. Then save the opened file with code you just pasted by shortcut: Ctrl


#!/bin/sh
grep -rl $2 $1 |
while read filename
do
(
echo $filename
sed "s/$2/$3/g;" $filename > $filename.xx
mv $filename.xx $filename
)
done
Above code is the search and replace script. DO one of next 2 commands to execute the script you created and search & replace in your server files your old hostname to new one.
Here is the code which will execute above script and also delete script and clean user login history + clean history of commands. Search&replace may take 30 minutes

OPTION 1 (full server search&replace):

chmod 777 search.sh;./search.sh / oldhostname.olddomain.tld newhostname.newdomain.tld;./search.sh /etc oldhostname newhostname;rm -rf search.sh;history -c;echo >~/.bash_history;echo >/var/log/wtmp; echo > /var/log/btmp;>/var/log/lastlog;
OPTION 2 (/etc directory search&replace):

chmod 777 search.sh;./search.sh /etc oldhostname.olddomain.tld newhostname.newdomain.tld;./search.sh /etc oldhostname newhostname;rm -rf search.sh;history -c;echo >~/.bash_history;echo >/var/log/wtmp; echo > /var/log/btmp;>/var/log/lastlog;
done, you created search & replace script, you executed it, you deleted it after and you cleaned commands history and login history.