1832235 Members
2934 Online
110041 Solutions
New Discussion

Login Menu

 

Login Menu

What is the best way to set up a user that on login has a menu displayed to select a home directory and/or a set of different environment variables?
6 REPLIES 6
Patrick Wallek
Honored Contributor

Re: Login Menu

A couple of ways to do that.

1) You can set their default shell in /etc/passwd so that it points to the menu script and then the menu invokes applications or a shell as needed.

2) You can have the menu script execute as the last in the users .profile file.
James R. Ferguson
Acclaimed Contributor

Re: Login Menu

Hi Malcolm:

There are two easy ways:

Choice-1 is to place the name of the menu script at the end of the user's profile, as:

# exec $HOME/usermenu.sh

Choice-2 is to substitute the menuscript for the normal shell as specified in '/etc/passwd'. That is, instead of the login shell (field-7), substitute the absolute path to the user's menu script:

# /home/theuse/usermenu.sh

Regards!

...JRF...
PIYUSH D. PATEL
Honored Contributor

Re: Login Menu

Hi,

Put the menu script in /etc/passwd file intead of the user shell OR put the entry at the end in the .pfofile file of the user.

Piyush
Dave La Mar
Honored Contributor

Re: Login Menu

Malcom -
We did something similar for a user id we wished to have access to only select items.
The call of the menu was placed in their .kshrc file as well as a source in of a file containing the necessary environment variables they would need.
Most important was the exit that would occur if the user exits the menu.
Below are the excerpts -

# environment variables needed.
./opt/apps/jobprod/config/jdaprod.env
# call the menu. ./opt/apps/jobprod/interface/jdaodbms/menu_name_script
# exit if they leave the menu.
exit
"I'm not dumb. I just have a command of thoroughly useless information."

Re: Login Menu

Thanks for the responses. I've tried both methods, I've set a menu which points a user to different directories depending on their input. However, when the menu input is complete the user is disconnected from the session.
Nick Wickens
Respected Contributor

Re: Login Menu

Have you considered setting up an alternate profile with the environment settings you want and calling the alternate profile via an alias in the main profile ? Then just print a menu upon initial login to remind the user which alias command to use to run the alternate profile ?
Hats ? We don't need no stinkin' hats !!