Limit a user's login prompt upon logon


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Limit a user's login prompt upon logon
# 1  
Old 04-05-2012
Limit a user's login prompt upon logon

Hey

Am new to scripting in aix 5.3

I need to write a script to limit a user's logon prompt to an interactive menu based upon logon and nothing else.

Any ideas much appreciated.

Smilie
# 2  
Old 04-05-2012
Add a line to /etc/shells with the full path and name of your script and assign that script as new login shell to the user either by editing his record in /etc/passwd or by using smitty or with the chuser command.
# 3  
Old 04-05-2012
@cero thanks

this is what i want to achieve,i want a user at noc who logins to our db server to run a backup script not to access the shell or alternatively not to be able to run anything other than the above task.

ok i want to achieve an interactive menu like below on logon
1.start backup
2.end backup
3.quit

user will be prompted to enter an option on logon

any idea on aix 5.3
# 4  
Old 04-05-2012
Quote:
Originally Posted by mills
...
i want a user at noc who logins to our db server to run a backup script not to access the shell or alternatively not to be able to run anything other than the above task.
The steps in my post above handle this part.

Quote:
Originally Posted by mills
ok i want to achieve an interactive menu like below on logon
1.start backup
2.end backup
3.quit

user will be prompted to enter an option on logon

any idea on aix 5.3
For an interactive menu there is the select command or you display the menu and use the read command to accept user input. Also have a look at the trap command to prevent the user from interupting your script.
Have a look at the man-pages or search this site to get an idea how to implement this, then try to create the script. If you're stuck somewhere just ask and we will try to help.
# 5  
Old 04-05-2012
this is what i did

Code:
#!/bin/bash
# clear the screen
tput clear
# Move cursor to screen location X,Y (top left is 0,0)
tput cup 3 15
# Set a foreground colour using ANSI escape
tput setaf 3
echo "123 company."
tput sgr0
tput cup 5 17
# Set reverse video mode
tput rev
echo "M A I N - M E N U"
tput sgr0

tput cup 7 15
echo "1. User Management"
tput cup 8 15
echo "2. Service Management"
tput cup 9 15
echo "3. Process Management"
tput cup 10 15
echo "4. Backup"
# Set bold mode
tput bold
tput cup 12 15
read "Enter your choice [1-4] " choice

Any idea how i can set the trap and finally introduce an executable script


below is an extract from the menu

Code:
 M A I N - M E N U

               1. User Management
               2. Service Management
               3. Process Management
               4. Backup

               .profile[47]: read: no query process

but after this it proceeds to the prompt

Moderator's Comments:
Mod Comment Welcome to the UNIX and Linux Forums. Please use code tags. Video tutorial on how to use them

Last edited by Scrutinizer; 04-05-2012 at 10:33 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Parse User Logon Count

Hey, My access.log for one application is not rolled over. I would like to get users count. Right now I am doing cat logon.list | grep 2013-09-11| |grep Succeeded | wc -l Since the file doesnt rotate out I have to grep for new date/ I tried to specify DATE=date "+DATE:... (2 Replies)
Discussion started by: brabored
2 Replies

2. Shell Programming and Scripting

passing login details to htaccess login prompt

Hi, How i can pass the login details to the URL which is password protected with the htaccess using command line or script (perl,or shell,or php). Any help or hint appreciated. Thanks, SJ (4 Replies)
Discussion started by: SilvesterJ
4 Replies

3. 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

4. Solaris

Help a user logon in SUN SOLARIS 10 ?

I logon with root user, then ok, but as a user logon is not, it is the login window forever ah, wishes to receive help from members of the forum, thanks very much. (2 Replies)
Discussion started by: tampc
2 Replies

5. Solaris

Solaris 8 logon problem with normal user

Hello. I have problem in Solaris 8. I can logon cde with root there is no problem. When I logon with normal user I am recieving black screen after 10 15 second login screen (cde pasword screen) coming again. 1 years ago we resolved same problem. We found a file It must be run with admin... (1 Reply)
Discussion started by: FATIH1453
1 Replies

6. Solaris

user logon details

how can i identifying whose are logged in last few days,time and date also want. what i will do for get that information (2 Replies)
Discussion started by: sijocg
2 Replies

7. BSD

Deny logon for x hours if login failed x times

Hello, I have a small inquiry. Sometimes, my good friend, Charlie Root, sends me security notifications that a possible breakin attempt has occured. It looks like this: Oct 29 06:58:17 cigva sshd: reverse mapping checking getaddrinfo for 180.144.164.220.broad.sm.yn.dynamic.163data.com.cn ... (2 Replies)
Discussion started by: brightstorm
2 Replies

8. UNIX for Dummies Questions & Answers

Error, Login Limit Exceeded by 1 user

Would appreciate some help, system was displaying an error regarding the kernal when a "sar" was run, after a reboot we get "WARNING user login limit exceeded by 1 user". We have plenty of licences. any ideas? (1 Reply)
Discussion started by: nchrocc
1 Replies

9. Shell Programming and Scripting

User Login Limit

Gud day :) We have a limited user login so we want to restrict 1 login per user. We have added below script in each user's profile but it is not working :confused: , I displayed the output for COUNT (by inserting echo command) but the value is always 1. Hope you could help me. Thanks ;) ... (3 Replies)
Discussion started by: lancemendioro
3 Replies

10. UNIX for Dummies Questions & Answers

Multiple user logon

I keep trying to use ssh shell to access my school's unix server from home and I get this error message: "This user id is logged on too many times. Please end some logins to reduce your total number of logins to no more than 1. Please do so in the next 1 minutes or you will be logged out... (3 Replies)
Discussion started by: hawkshot
3 Replies
Login or Register to Ask a Question