Jump to content

changing my hostname ???


bigjohn
 Share

Recommended Posts

firstly it may not be your hostname

hostname

will return you complete hostname

 

heres mine

paul@trinity paul $ hostname 

trinity.loudas.com

paul@trinity paul $

 

it could be your bash settings. Your bash prompt (PS1) should be set to something like this

[33[01;32m]u@h [33[01;34m]W $ [33[00m]

 

you can check by doing this

echo $PS1

 

is it is radically different then change it like this

export PS1=[33[01;32m]u@h [33[01;34m]W $ [33[00m]

Link to comment
Share on other sites

incase it IS your hostname .. it can be changed permanently here:

/etc/sysconfig/network

example:

[paul@dozer paul]$ cat /etc/sysconfig/network

GATEWAYDEV=eth0

NETWORKING=yes

FORWARD_IPV4=false

HOSTNAME=dozer.loudas.com

DOMAINNAME=loudas.com

GATEWAY=192.168.1.1

 

then restart networking

service network restart

Link to comment
Share on other sites

incase it IS your hostname .. it can be changed permanently here:

/etc/sysconfig/network

example:

<!--QuoteEBegin--><!--QuoteEBegin-->[paul@dozer paul]$ cat /etc/sysconfig/network<!--QuoteEBegin--><!--QuoteEBegin-->GATEWAYDEV=eth0<!--QuoteEBegin--><!--QuoteEBegin-->NETWORKING=yes<!--QuoteEBegin--><!--QuoteEBegin-->FORWARD_IPV4=false<!--QuoteEBegin--><!--QuoteEBegin-->HOSTNAME=dozer.loudas.com<!--QuoteEBegin--><!--QuoteEBegin-->DOMAINNAME=loudas.com<!--QuoteEBegin--><!--QuoteEBegin-->GATEWAY=192.168.1.1<!--QuoteEBegin--><!--QuoteEBegin-->

 

then restart networking

service network restart

 

Before I go and really screw things up :D

 

I have my own domain name of lehuray.org.uk Can I use the above description to change the domain name setting to lehuray.org.uk , bearing in mind that I use a dialup connection and don't have an internal network, or will that create problems connecting etc?

 

I already have my hostname set to daves-linux.

Link to comment
Share on other sites

I think that may cause problems

until recently my home network was called loudas.home (my domain is loudas.com) this worked quite well

 

machinename.loudas.home did not interfere with loudas.com

Link to comment
Share on other sites

Sorry Paul but this is going to sound like im being really thick!

 

But how do I change it again (i.e. what do i need to type in?)

 

Because john@localhost.john is the host name but at the bash prompt it comes up as

 

john@john@.localhost.john

 

regards

 

John

Link to comment
Share on other sites

type in this:

export PS1=[33[01;32m]u@h [33[01;34m]W $ [33[00m]

and see if it looks any better

if it does .. then edit a file in your home directory called .bashrc and put that line in that file

Link to comment
Share on other sites

type in this:

export PS1=[33[01;32m]u@h [33[01;34m]W $ [33[00m]

Oh my God!!! all that stuff for a test??? Do you want to scare bigjohn? :D :P

 

wouldn't be simplier to test a:

export PS1="u@h W $ "

 

which is the same but w/o the colour complication

 

Bigjohn, open a Konsole and type:

~$ export PS1="u@h W $ "

 

(remember a $ prompt is for normal users input)

if you get the same weird hostname, then follow paul advice about /etc/sysconfig/network; if not, then post here the content of the files:

/etc/bashrc

/home/john/.bashrc

 

and we'll try to help you

Link to comment
Share on other sites

I've just read this:

 

Because john@localhost.john is the host name but at the bash prompt it comes up as

 

john@john@.localhost.john

 

Then everything is alright except your hostname.

 

A host name is in the form "machine name" + "domain name", so your host name should be only something like "localhost.localdomain" or if you wish "localhost.john" and not "john@localhost.john".

john is your user name, so your email address as is user@host.domain is john@localhost.john; I guess you are using an email address as your hostname

Link to comment
Share on other sites

Another way to change your hostname is (I think)

 

Open a terminal and type

 

hostname whatever.

 

I wouldn't make it the same as the domain name unless you are mapped to your machine somehow (Doesn't sound like it). If you have a domain name and no place to host it, talk to anon as he knows a good cheap site :)

Link to comment
Share on other sites

aru (and any other of you who know what it all means)

 

This is my /etc/bashrc file

# /etc/bashrc

 

# System wide functions and aliases

# Environment stuff goes in /etc/profile

 

# by default, we want this to get set.

# Even for non-interactive, non-login shells.

if [ `id -gn` = `id -un` -a `id -u` -gt 99 ]; then

umask 002

else

umask 022

fi

 

# are we an interactive shell?

if [ "$PS1" ]; then

case $TERM in

xterm*)

PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME}: ${PWD}07"'

;;

*)

;;

esac

[ "$PS1" = "s-v$ " ] && PS1="[u@h W]$ "

 

if [ -z "$loginsh" ]; then # We're not a login shell

for i in /etc/profile.d/*.sh; do

if [ -x $i ]; then

. $i

fi

done

fi

fi

 

unset loginsh

 

and this is my /home/john/.bashrc

 

# .bashrc

 

# User specific aliases and functions

 

# Source global definitions

if [ -f /etc/bashrc ]; then

. /etc/bashrc

fi

 

and as to using an e-mail address as my hostname, no it's just what seems to have come up when I last re-installed (though I don't recall why I re-installed about a month ago)!

 

also, when I typed in export PS1="u@h W $ " I got nothing, just returned me to a $ prompt.

regards

 

John :?:

Link to comment
Share on other sites

both files seem OK.

 

OK, what do you get after following paul's advices in 2nd and 3th post in this thread; ie, post what do you get while executing the following commands in konsole (copy and paste here the whole output, even the prompt):

 

hostname

cat /etc/sysconfig/network

echo $PS1

whoami

Link to comment
Share on other sites

[john@john@localhost john]$ hostname

john@localhost.john

[john@john@localhost john]$ cat /etc/sysconfig/network

NETWORKING=yes

FORWARD_IPV4=false

HOSTNAME=john@localhost.john

DOMAINNAME=john

GATEWAY=192.168.7.1

[john@john@localhost john]$ echo $PS1

[u@h W]$

[john@john@localhost john]$ whoami

 

This is what I got by copying and pasteing into Konsole

though what it means :?:

 

regards

 

John

Link to comment
Share on other sites

[

[john@john@localhost john]$ cat /etc/sysconfig/network

NETWORKING=yes

FORWARD_IPV4=false

HOSTNAME=john@localhost.john

DOMAINNAME=john

GATEWAY=192.168.7.1

 

OK, the problem is with the HOSTNAME variable. It should be "localhost.john" instead of "john@localhost john"

 

As root, run the following two commands (copy and paste only the text in blue); you won't even need to use a text editor:

 

~# sed "s/(HOSTNAME=).*/1localhost.john/" /etc/sysconfig/network > /tmp/network && cat /tmp/network > /etc/sysconfig/network

~# service network restart

 

then logout and login back

 

HTH

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...