Operating System - HP-UX
1753312 Members
6364 Online
108792 Solutions
New Discussion юеВ

How to modify User Path Enviornemt to include additional dir

 
johnnymac_1
Advisor

How to modify User Path Enviornemt to include additional dir

Very new to HP-UX, please forgive my simple question. If I wanted to add an additional path to a user enviornment (exmaple /opt/Opensource/software)for user smithj what would I type at the console? This setting would be permanent and not remove any current path settings.
Also how can I identify at setup or modify existing accounts if I want their shell to be BASH instead of what it is currently?

A million thanks
John
8 REPLIES 8
Robert_Jewell
Honored Contributor

Re: How to modify User Path Enviornemt to include additional dir

Adding to the PATH variable would require editing the users profile file. Typically this is .profile located in the users home directory. Within the .profile there is a line similar to as follows:
PATH=$PATH:.

You could add to this as follows:
PATH=$PATH:/opt/Opensource/software:.

Or if you want every user to have access to this path edit the file /etc/PATH to include the directory. This file is sourced by /etc/profile for every user.

You do not mention the OS version, but the simplest way to change a user's default shell is to use the utility "sam" (for version 11.11 and 11.23) or the utility "smh" (for version 11.31). Either way look for Users and Groups and edit that user's "start up program" as needed. This will edit the /etc/passwd file making the needed changes.

-Bob
----------------
Was this helpful? Like this post by giving me a thumbs up below!
Tim Nelson
Honored Contributor

Re: How to modify User Path Enviornemt to include additional dir

edit the users .profile in their home directory and add the /opt/Opensource/software to the end of the PATH variable.

something like the below.
export PATH=$PATH:/opt/Opensource/software

I do not believe bash is fully operational on hpux but if you really want it then,

edit /etc/passwd for the user and change the last field. or usermod -s /path/to/bash username
Alzhy
Honored Contributor

Re: How to modify User Path Enviornemt to include additional dir

edit /etc/PATH for global effect on ALL users.
Hakuna Matata.
Steven Schweda
Honored Contributor

Re: How to modify User Path Enviornemt to include additional dir

> Very new to HP-UX, [...]

Very new to _which_ HP-UX?

uname -a


Changing the shell for user "root" can cause
serious problems, so I'd advise leaving that
user's shell unchanged. Changing the shell
for other users should be mostly harmless.


> I do not believe bash is fully operational
> on hpux but if you really want it then,

I use it without any trouble. What do you
think doesn't work properly? (In which
"bash" version? On which HP-UX version?)


> [...] please forgive my simple question.

You really should do some reading.
Alzhy
Honored Contributor

Re: How to modify User Path Enviornemt to include additional dir

JM,

For HP-UX, easiest is to edit /etc/PATH and add the software's executable's path. It will set all user's PATH to include the changes you made irrespective of their SHELL.

Now to change the SHELL of your users, you can USE:

usermod
OR
chsh


whch is the PROPER way to do it.
Hakuna Matata.
Dennis Handly
Acclaimed Contributor

Re: How to modify User Path Environment to include additional dir

>for user smithj

Any reason you don't let each user do this themselves?

Manix
Honored Contributor

Re: How to modify User Path Enviornemt to include additional dir

two simple things /etc/profile for global & .profile for locals user level env settings.
HP-UX been always lovable - Mani Kalra
James R. Ferguson
Acclaimed Contributor

Re: How to modify User Path Enviornemt to include additional dir

Hi John:

SInce you mentioned the Bash shell, I will caution you that that's fine for non-root users to have defined (in '/etc/passwd') their default shell to be Bash. *However* do not ever change root's default shell from the statically linked '/sbin/sh'. To do so may leave you with an un-startable system.

Regards!

...JRF...