How to mount a iso file

June 21, 2009

So you’ve a cd image in iso format and you want to accesss it. Quite simple, it consists of two parts, creating a loopback device and then mounting this block device to any mount point.

1. Creating a loopdevice using lofiadm

# lofiadm -a /export/home/cdimage.iso /dev/lofi/1

If this file already exists then simply go for /dev/lofi/2 and so on.

2. Mounting the block device to a mount point

# mount -F hsfs -o ro /dev/lofi/1 /mnt/cdrom

Here hsfs is the filesystem type for CD-ROM/DVD on Solaris platform.

Fortunately there is a quicker alternative to firing both the commands. The output of these can be achieved in a single command

# mount -F hsfs -o ro `lofiadm -a /export/home/cdimage.iso` /mnt/cdrom

Ans so now you can access the iso like a mount cdrom at the mount point.

To unmont use ‘umount’ command and the mount point.

# umount /mnt/cdrom

And so you’re done.


How to change IP address

June 20, 2009

If your solaris system has a static address assigned to it and you wish to change it, simply update the files corresponding to your version of Solaris as explained below.

Solaris 9 and below change the IP in following file


Solaris 10 till update 3



Solaris 10 update 4 and later


In case you also want to change your gateway, change the router address in…


Also ensure that you have the correct netmask mentioned in the file…


Create the netmasks file if it does not exist.

How to Track Users on Solaris

June 20, 2009

So you want to check who have ever accessed your Solaris system. Tracking or monitoring users on a system is quite an important part of ‘Solaris Adminstrators’ role.

There are two parts to it:

– Who is currently logged in

– Who has previously accessed this machine

To the details of users who are currently logged in to the system, fire the following command:

# who

This gives the limited details of the user logged in. If you also want to know who is running what program, there is another command:

# w

But this is only about the users who currently logged in to the system. What about if they logged out some time back. Or if they used your system when you were not monitoring? No worry …

# last

This command records all login and logouts. So you may have to use more or less to control the output.

There is one more log that keeps record of user switching. So if anybody has used su command to swith to some other user it will keep a log of it under /var/adm/sulog. You can cat this file to see the output.

# cat /var/adm/sulog

SU 06/26 16:25 + syscon root-root

SU 06/26 17:39 + syscon root-root

SU 07/02 11:11 + console root-sysadmin

SU 07/02 11:19 + console root-mgreen

SU 07/07 09:11 + pts/1 sysadmin-root

SU 07/08 10:45 + pts/4 testuser-root

So if somebody logged in as root directly then it would come under last command and if someone is logging in as normal user but later switching to root with ‘su’ command you can check that in the sulog.

Now you have complete information of users logging in to your system.

How to share a directory through nfs

June 10, 2009

This is quite simple than you thought. First just make sure that your nfs server is enabled or not with the following command:

# svcs network/nfs/server
STATE          STIME    FMRI
online         16:01:36 svc:/network/nfs/server:default

And if working you will get an output as shown above or else you will get something like…

STATE          STIME    FMRI
disabled       17:42:25 svc:/network/nfs/server:default

If this is the case you need to enable your nfs server with svcadm command as shown below:

# svcadm enable network/nfs/server

Confirm that your nfs server is running with the above command.

Once you are sure that your nfs is running, next task is to share the directory.

Now for example purpose, say you want to share ‘/export/home/share’ directory. Fire the following command straight away:

#/usr/sbin/share -F nfs -o ro,anon=0 /export/home/share

To check all the directories shared on your Solaris system, use the share command:


-               /nbsin_share   ro,anon=0   ""   /export/home/share

And you should get the output as shown above.

But make a note that this is a temporary sharing of the directory. If you happen to reboot your system or restart the nfs service the sharing will be disabled.

By default only those directories are shared by the nfs server who have an entry into its configuration file located at ‘/etc/dfs/dfstab’

So to make our above directory sharing persist forever we will append our share command into dfstab file:

#echo "/usr/sbin/share -F nfs -o ro,anon=0 /export/home/share" >> /etc/dfs/dfstab

Then we’ll ask the nfs service to share all the directories as metioned in dfstab file with the following command:


You can crosscheck your sharing by ‘share’ command as now you already know.

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 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: unknown #set by DHCP

Simply edit the file to replace ‘unknown’ with your hostname to make it look like as: 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 🙂

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.