How to set the hostname in Solaris 10

May 23, 2009

If you have a system with a fresh installed Solaris 10 and it does not have an entry with ‘name server’, there are chances that it’ll set the hostname as ‘unknown’. To change this hostname you need to edit 3 files, follow the following steps:

For the sake of example, say the IP of my system is 192.168.1.32 and I want to set the hostname to ‘sol10_sparc’

File 1

Use a text editor like vi to open and edit the following file:

# vi /etc/hosts

By default you’ll find the following line in the above file:

192.168.1.32 unknown #set by DHCP

Simply edit the file to replace ‘unknown’ with your hostname to make it look like as:

192.168.1.32 sol10_sparc #set by DHCP

File 2

Next we need to edit the file called nodename

# vi /etc/nodename

Just insert the hostname ‘sol10_sparc’ into this file.

File 3

And now last, find out the name of your ethernet card with the ‘ifconfig -a’ command. Say my ethernet card is called ‘rge0’. I’ll create and edit the following file:

# vi /etc/hostname.rge0

Insert your new hostname ‘sol10_sparc’ in this file, save and exit.

Restart your machine:

# init 6

That’s it, after your machine restarts, check the hostname:

# hostname

Done, enjoy 🙂

Advertisements

How to enable root access to SSH

May 23, 2009

To perform this you need to access the terminal physically or via telnet. And obviously you have to be a root user.

From terminal, use a text editor like vi to open the configuration file of SSH

# vi /etc/ssh/sshd_config

Now look for following line in the file:

PermitRootLogin no

You need to replace the ‘no’ with ‘yes’ to enable SSH.

Save the file and exit.

Restart the SSH service with the following command:

# svcadm restart network/ssh

That’s it, you’re done.