Operating System - HP-UX
1831642 Members
1781 Online
110027 Solutions
New Discussion

How To Restrict $ Prompt!!!!

 
NUTANKUMAR
Occasional Contributor

How To Restrict $ Prompt!!!!

Hellow to every body,

I have kept some menu script in .profile of user so when I am doing,
# su - user --> no problem.
But in case of,
# su user --> I am getting $ prompt, how to avoid it.

Next question is,
While doing,
# pg filename <-
if i issue a command "!sh" at colon (:), I get a $ prompt, How to avoid it.



thanx
4 REPLIES 4
CHRIS_ANORUO
Honored Contributor

Re: How To Restrict $ Prompt!!!!

Setup the users .profile with the startup command of the programme.
Include the executable command in the .profile of all the users and use the su -c user
(su -c oracle)
The second part of the question is okay. it's result is right.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
John Palmer
Honored Contributor

Re: How To Restrict $ Prompt!!!!

Hi,

To answer your second question, pg and lots of other programs use the contents of the variable SHELL which will be set to the shell entry for the user from /etc/passwd.

If you change this to '/usr/bin/false' or maybe to the name of a script that simply prints a message like 'Shell access not allowed!' then the user will not get a shell prompt.

James R. Ferguson
Acclaimed Contributor

Re: How To Restrict $ Prompt!!!!

Hi:

One simple solution to your first question is to add the following line to the bottom of the user .profile:

exec
Upon exiting
With regard to your second question, John's response above applies. Using John's suggestions and the exec
...JRF...
glovecar
Occasional Advisor

Re: How To Restrict $ Prompt!!!!

OS Rule..

1. su user
Switching user without exec .profile (env file)

2. su - user
Switching user and exec .profile

"-" : exec .profile (env file)