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


 
Thread Tools Search this Thread
Operating Systems AIX How to: Run backup_menu.sh at login for only one user
# 1  
Old 04-17-2010
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
# 2  
Old 04-17-2010
Capture Ctr-C with the trap command in your script, something like:
Code:
trap "Ctr-C pressed" SIGINT

and use the exec command to start the script:
Code:
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
# 3  
Old 04-18-2010
Question

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
# 4  
Old 04-18-2010
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Prevent user from creating new user from his login

Hi Experts, Need your support Redhat 6.5 I want to create a user with all(read, write, execute) privileges except that user should not be able to create any new user from his login to perform any task. (10 Replies)
Discussion started by: as7951
10 Replies

2. Solaris

Run commans as no login shell user

Hi All, I have problem running a command with another user who has no login shell the os is solaris 10 i am root and doing the following: su user -s /bin/bash "ls" no output .. no error messages if su - user i got No directory Please use CODE tags as required by forum... (2 Replies)
Discussion started by: BF_DEV
2 Replies

3. Shell Programming and Scripting

Login into another user from user inside script

now i have logged in username : ramesh in unix Now i have to created script file to login into another user and have run a command inside that user and after executing the command i have to exit from that user. Inside script, i have to login into su - ram along with password : haihow and have to... (4 Replies)
Discussion started by: rammm
4 Replies

4. AIX

User Account Login Login on your AIX server

I want to learn AIX. I would like to find someone who would be willing to give me a login to their AIX home lab server. My intent is to poke around and discover the similarities and differences of AIX compared to other *NIXs. I am a UNIX admin so I can think of what some immediate concerns may... (1 Reply)
Discussion started by: perl_in_my_shel
1 Replies

5. Shell Programming and Scripting

How to Login as another user through Shell script from current user[Not Root]

Hi Every body, I would need a shell script program to login as different user and perform some copy commands in the script. example: Supppose ora_toms is the active user ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands ... (9 Replies)
Discussion started by: ujjwal27
9 Replies

6. Shell Programming and Scripting

Help to hide shell terminal and run prompt program after ssh login for specified user

Hey guys, I have some task from my office to lock user on the specified directory after the user logged on using ssh. And then run prompt program to fill the required information. Yeah, just like an ATM system. My question: How could I do those?? AFAIK I have to edit the ~./bashrc. But the... (1 Reply)
Discussion started by: franzramadhan
1 Replies

7. Solaris

error message rmclomv ... SC Login Failure for user Please login:

Hello World ~ HW : SUN Fire V240 OS : Solaris 8 Error message prompts 'rmclomv ... SC login failure ...' on terminal. and Error Message prompts continually 'SC Login Failure for user Please login:' on Single Mode(init S) The System is in normal operation, though In case of rain, Can... (1 Reply)
Discussion started by: lifegeek
1 Replies

8. Shell Programming and Scripting

Run script at first login user (only)

Hi all, I would need a script to run only at the first login of a newly created user. And at the first time only. I did some googlework but unfortunatly... I made up it possibly had something to do with the bashrc file. This script is some kind of info for the user ; with the possiblity to... (1 Reply)
Discussion started by: laurens
1 Replies

9. Shell Programming and Scripting

Running script from other user rather than login user

Hi, My requirement is that i am login from ROOT in a script but when any command is coming which is logging to sqlplus then i have to run it with normal user as only normal user have permission to connect to sqlplus . i tried making a script like this : #! /bin/ksh su -... (3 Replies)
Discussion started by: rawatds
3 Replies
Login or Register to Ask a Question