How to: Run backup_menu.sh at login for only one user

Hi all,

I Hope to find the answer.

I am new to aix 5L, I have one oracle 10gR2 database server run on ain 5L
so when I start my new Job I find that the operater login oracle user and run the backup_menu.sh, this menu is to make a backup of the database top disk and transfer it to tape, after that ther OP. logout.

for the security, that way is not secure. so I need to create (BACKUP) user when login will run that script and logout the system after finsh.

the user must be restricted user no (CTRL+C) or any interupt key must be accepted else the numbers in the choice menu.

I do it in OpenVMS OS.

HOW TO DO IT IN AIX 5L.

hope to help me plzzzz

regards
Essam

Capture Ctr-C with the trap command in your script, something like:

trap "Ctr-C pressed" SIGINT

and use the exec command to start the script:

exec backup_menu.sh

Note that in backup_menu.sh there must be an exit statement at the end of the script.

Have a read of the man page of those built-in commands of your shell.

Regards

Thanks Frank

I attach my script for you.

SO, how to run script after login automaticly. ie: when the user login the menu in the scipt will the only one he can use it. and if the user chose EXIT, then he logout from the system.

I found in some forums smothing like :

  • How to create a restricted shell user in 4.2 and 5L . and he will be able to execute some come commands.

  • There is a lot of different ways to do this but I found the best way is to

  1. Create a user on the system that will be used for this

  2. vi /etc/password file and change the user to match root users eg ....
    new_user_name::202:1::/etc/ipsec:/usr/bin/ksh
    from this to this
    new_user_name:
    :0:0::/etc/ipsec:/home/new_user_name/menu_script_file_name.ksh

  3. As you can see this user will have the same access as root but will not have a shell.

  4. You now need to create a shell script that has a menu function that will allow for selection of the command you need to run. ( do net give shell access only scripts )

  5. The user can not break out of the menu as he has no shell and will be logged out. 6. set the password for the user

I try it and not work for my script .

PLZ. help need it.

regards
Essam

I would not use change the UID of your new_user_name to zero. You are after all trying to enhance the security - not reduce it. The easiest way to do this is to implement a tool called sudo, and allow the commands you need to have run as root enabled for this backup user as root. Thenin your script where the command is insert the sudo command before the command you wish to run as root and voila.

with laer vesions of AIX you can also use RBAC (Role Based Access Control) to achieve this.