/etc/hosts via ssh

Hi,

I want to change the /etc/hosts file on the hmc. I am connecting via ssh but any vi command is not allowed.

Can someone please let me know how to do this?

Many Thanks.
Kees

are you loged in as "root"?

yeah I am. well hscroot.

what is the output when you try a:
"vi /etc/hosts" ?

"-bash: vi: command not found" is what I get, sorry for being a complete idiot but i'm very new to all of this :frowning:

I don't know any other editors that I can use as I've only ever vi.

try:
/usr/bin/vi /etc/hosts
and post the output off:
echo $PATH

Here you go.

hscroot@ehchmc01:~> echo $PATH
/hmcrbin/:/usr/hmcrbin
hscroot@ehchmc01:~> /usr/bin/vi /etc/hosts
-bash: /usr/bin/vi: restricted: cannot specify `/' in command names

you don't have the basic directorys for the unix programs in your path. something like this:
/usr/sbin:/usr/bin:/opt/bin:/usr/local/bin

but i don't know what the other problem is. maybe the path to vi is not correct?!? i'm on solaris and don't know aix...

Because it's a ssh connection you have a massively restricted choice of options to use, but cheers for the help anyway Duke

you can set the path on your own! try this:

PATH=${PATH}:/usr/sbin:/usr/bin:/opt/bin:/usr/local/bin
export PATH

vi /etc/hosts

Duke, I got the following error, do I need to try it a different way?

hscroot@ehchmc01:~> PATH=$PATH:/usr/sbin:/usr/bin:/opt/bin:/usr/local/bin
-bash: PATH: readonly variable

Why do you need to change the /etc/hosts file on the HMC anyway?

I need to add in entries for our managed servers on it.

seems like the shell and the user is restricted... so you have to get "root" rights to do the job!

Please post the output of

ls -l /
-rw-r--r--    1 root     root            0 2005-07-06 08:30 0
drwxr-xr-x    2 root     root         4096 2005-04-19 01:43 bin
drwxr-xr-x    3 root     root         4096 2005-04-19 01:43 boot
lrwxr-xr-x    1 root     root           10 2004-05-18 05:03 console -> /opt/ccfw/
drwxr-xr-x   30 root     root        61440 2006-07-31 13:03 dev
drwxr-xr-x    5 root     root         4096 2007-01-20 12:43 dump
drwxr-xr-x   46 root     root         4096 2007-01-23 14:48 etc
drwxr-xr-x    3 root     root         4096 2005-07-06 10:21 extra
drwxr-xr-x    2 root     root         4096 2004-10-13 00:06 hmcrbin
drwxr-xr-x    6 root     root         4096 2006-11-01 10:33 home
drwxr-xr-x    4 root     root         4096 2005-07-06 10:23 info
drwxr-xr-x    6 root     root         4096 2005-07-06 08:28 lib
drwx------    2 root     root         4096 2004-04-16 16:11 lost+found
drwxr-xr-x    4 root     root         4096 2004-04-16 08:17 media
drwxr-xr-x    4 root     root         4096 2004-04-16 12:45 mnt
drwxr-xr-x   10 root     root         4096 2005-07-06 08:35 opt
dr-xr-xr-x  419 root     root            0 2006-07-31 13:02 proc
drwx------   11 root     root         4096 2005-07-06 10:46 root
drwxr-xr-x    3 root     root         4096 2005-07-06 08:28 sbin
drwxr-xr-x    4 root     root         4096 2004-04-16 08:17 srv
drwxrwxrwt   12 root     root         8192 2007-02-13 14:00 tmp
drwxr-xr-x   15 root     root         4096 2005-07-06 10:24 usr
drwxr-xr-x   22 root     root         4096 2005-08-12 11:11 var
lrwxr-xr-x    1 root     root           16 2005-05-04 23:44 wsmssl-ext.jnlp -> wsmssl-none.jnlp

I've got similar problems with other commands

pls verify environment variable SHELL

$ echo $SHELL
/bin/hmcbash <__or__> bin/bash

hmcbash is very restricted

Access per root to HMC seems to be not allowed

I haven't any idea how to get ride of them :confused:

Anyone other ... ?

You don't get access to root on the HMC with out IBM support. There is a root password which depends on the serial number of the machine and also the date and time of day. You will have to call IBM support to have them give you a root password which will only work for one or two days.

You can't edit the /etc/hosts file on HMCs like you can on a normal unix box. Check the man page for chhmc. I think there is a way to add aliases. Will check this out tomorrow and let you know how it's done (if at all possible).

The HMC is based on linux but cannot be used as, or like, a UNIX machine, you only have a restricted shell.
You do not need to add your managed systems to /etc/hosts.

To add a managed system, select the Server Management bar and choose Add
Managed System(s)