Operating System - HP-UX
1753396 Members
7258 Online
108792 Solutions
New Discussion юеВ

Re: env command not working with root

 
SOLVED
Go to solution
vrjalli
New Member

env command not working with root

hi experts,
With root user when I wish to know the env variable and give command 'env' I am getting the error as below

# env
env: setenv: not found
env[2]: setenv: not found
env[3]: setenv: not found
env[4]: setenv: not found
#
--------------------------------------------
# uname -a
HP-UX hostname B.11.31 U ia64 2308917168 unlimited-user license
-----------------------------------------------
# more /etc/passwd
root:xTJErm.a8LWnc:0:3::/:/usr/bin/ksh
daemon:*:1:5::/:/sbin/sh
bin:*:2:2::/usr/bin:/sbin/sh
sys:*:3:3::/:
adm:*:4:4::/var/adm:/sbin/sh
uucp:*:5:3::/var/spool/uucppublic:/usr/lbin/uucp/uucico
lp:*:9:7::/var/spool/lp:/sbin/sh
nuucp:*:11:11::/var/spool/uucppublic:/usr/lbin/uucp/uucico
hpdb:*:27:1:ALLBASE:/:/sbin/sh
nobody:*:-2:-2::/:
www:*:30:1::/:
smbnull:*:101:101:DO NOT USE OR DELETE - needed by Samba:/var/opt/samba/nologin:/bin/false
cimsrvr:*:102:102:WBEM Services:/var/opt/wbem:/sbin/sh
tftp:*:103:103:Trivial FTP user:/home/tftp:/usr/bin/false
sfmdb:*:104:20::/home/sfmdb:/sbin/sh
sshd:*:105:104:sshd privsep:/var/empty:/bin/false
iwww:*:106:1::/home/iwww:/sbin/sh
owww:*:107:1::/home/owww:/sbin/sh
hpsmh:*:108:105:System Management Homepage:/var/opt/hpsmh:/sbin/sh
-----------------------------------------------

how to set env in HPUX, can someone help me

rgds
jalli
6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: env command not working with root

>root:xTJErm.a8LWnc:0:3::/:/usr/bin/ksh

Immediately change root's shell back to /sbin/sh! Otherwise you won't be able to reboot the system.

># env
env: setenv: not found

What does "whence -v env" show?

setenv is a scummy C shell command. What is the contents of your "env" script?

You could try /usr/bin/env.
vrjalli
New Member

Re: env command not working with root

Hi Denns - thanks for swift response . .

here are the outputs.

# whence -v env
env is /usr/bin/env
# ls -l /usr/bin/env
-r-xr-xr-x 1 bin bin 147 Oct 14 15:08 /usr/bin/env
# /usr/bin/env
/usr/bin/env: setenv: not found
/usr/bin/env[2]: setenv: not found
/usr/bin/env[3]: setenv: not found
/usr/bin/env[4]: setenv: not found
---------------------
# more /usr/bin/env
setenv $ORACLE_HOME /oracle/SID/102_64
setenv $ORACLE_SID SID
setenv $ORACLE_STAGE /oracle/SID/stage
setenv $ORACLE_BASE /oracle
SAPSYSTEMNAME=SID

I changed the root shell to /sbin/sh

. . .

rgds

jalli
Dennis Handly
Acclaimed Contributor
Solution

Re: env command not working with root

# ls -l /usr/bin/env
-r-xr-xr-x 1 bin bin 147 Oct 14 15:08 /usr/bin/env
# /usr/bin/env
/usr/bin/env: setenv: not found

root has destroyed the env(1) command. Do you have a backup? Or another machine you can get it from?

# more /usr/bin/env
setenv $ORACLE_HOME /oracle/SID/102_64

This csh script fragment should have been put elsewhere.
vrjalli
New Member

Re: env command not working with root

thanks . .

Let me try to get the copy of env from other machine.

where to put the csh strings below:

setenv $ORACLE_HOME /oracle/EC6/102_64
setenv $ORACLE_SID EC6
setenv $ORACLE_STAGE /oracle/EC6/stage
setenv $ORACLE_BASE /oracle
SAPSYSTEMNAME=EC6


Will it be fine if we place in .profile of root under '/' ?


thanks you

Patrick Wallek
Honored Contributor

Re: env command not working with root

If you wish to set those for the 'root' user you should use 'export' rather than setenv.

For example:

export ORACLE_HOME=/oracle/EC6/102_64
export ORACLE_SID=EC6
export ORACLE_STAGE=/oracle/EC6/stage
export ORACLE_BASE=/oracle
export SAPSYSTEMNAME=EC6

You can put the above statements in roots .profile file.
vrjalli
New Member

Re: env command not working with root

Hi Dennis and Patrick,

Yes Dennis is absolutely right.

I copied the env file from other machine (copied in binary mode)

and it is working fine.


Thank you guys and thanks to forum, as well.

Regards

Jalli