LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-16-2005, 02:09 PM   #1
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Rep: Reputation: 15
Question Non GUI User/Profile Boot Menu?


Ok ... Here is what I am trying to do ... I want to set up a local user/profile that when they log in at the prompt it goes directly to a Non GUI menu with 3 or 4 options (i.e. Ping, TraceRoute, Netconfig, Ifconfig, Log out) I don't want them to be able to do anything but what I put on the menu. I am a real at this but am trying to learn... so My questions are:

1. Has anyone done this b4?
2. How is the best way to create the menu (Non GUI)?
3. Thoughts on security (how to keep them out of other things)?

**Bonus: It would be really cool if I could create different menus for each user/profile

I know some of this is elementary so I am currently trying to read up on redhat security.

I am doing this just in case I want someone other than myself to login the server, but I don't want them to be able to look around in it.

Any help would be great ... Links to information or scripts to help in this would be awesome too... Thanks in advance!!!
 
Old 06-16-2005, 05:17 PM   #2
ReefShark
Member
 
Registered: Oct 2003
Location: the Netherlands
Distribution: Arch Linux, Ubuntu server
Posts: 145

Rep: Reputation: 15
Off the top of my head (not a working linux install in sight over here, doing a massive reinstall of all my boxes), but the trick is in the password file. Don't set /bin/bash as the login shell, but the menu script. You can easily write one in shellscript (bash, sh or pdksh), but perl would also be an option (bash will be easier I think). Because the user has no real shell, any attempt to exit the menu (CRTL+C for instance) will log them out.

Hope I remember this correctly
 
Old 06-16-2005, 05:20 PM   #3
mcd
Member
 
Registered: Aug 2003
Location: Boulder, CO
Distribution: Slackware, RHEL, CentOS
Posts: 825

Rep: Reputation: 33
there's also something called chroot i believe, which allows you to lock users that log in into a certain directory. so you could create a directory called /login or something, with only the commands and scripts that you want them to be able to run, and they couldn't access anything outside that directory. unfortunately i've never used it, but a quick google search netted me this (seemingly) helpful link: http://www.tjw.org/chroot-login-HOWTO/
 
Old 06-16-2005, 05:43 PM   #4
ReefShark
Member
 
Registered: Oct 2003
Location: the Netherlands
Distribution: Arch Linux, Ubuntu server
Posts: 145

Rep: Reputation: 15
A chroot (jail) is nice, but he only wants them to have access to a menu, not even a shell (even if it is chrooted). So even a chroot would give them too much rights/options
 
Old 06-16-2005, 10:14 PM   #5
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
Talking

Wow... thats great information ... Thanks so much for all of your help, hopefully that will atleast get me pointed in the right direction.... all links are welcome.
 
Old 06-17-2005, 04:07 PM   #6
ReefShark
Member
 
Registered: Oct 2003
Location: the Netherlands
Distribution: Arch Linux, Ubuntu server
Posts: 145

Rep: Reputation: 15
Quote:
Originally posted by bigdog0007
Wow... thats great information ... Thanks so much for all of your help, hopefully that will atleast get me pointed in the right direction.... all links are welcome.
I just googled around a bit, but found nothing... yet. If I do, I will let you know
 
Old 06-17-2005, 04:42 PM   #7
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
Cool

Just in case anyone else is following this ... I did find a good site for helping learn script.....

http://www.freeos.com/guides/lsst/

This particular part had a good example of a menu

http://www.freeos.com/guides/lsst/ch04sec11.html

Thanks
 
Old 06-22-2005, 12:45 PM   #8
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
Ok .. Here is what I have so far ... let me know if you can help me a bit... This menu is working ok .. but when it executes one of the options (i.e. Option "B" Ping) After it is finished it goes back to the command prompt. I tried to write it with a loop but that dosen't seem to work ... can any one help me out.. it would also be cool if i could get the results to open up another terminal session to actually run the commands... so they could be viewed right then instead of having to view the log... Thanks in advance for all help...anyway here is what I have:





#
#This is a limited user menu
#

date >> menuoutput.tmp

#Menu creation
dialog --backtitle "Menu for running dianostics on this Server " --title "Main \
Menu" --menu "Move using [UP], [DOWN], and [Enter] to \
Select " 15 50 5 \
A "IFConfig" \
B "Ping" \
C "TraceRoute" \
D "NetConfig" \
E "Exit" 2>/tmp/clsmenuitem.$$


clsmenuitem=`cat /tmp/clsmenuitem.$$`

opt=$?


case $clsmenuitem in
A) echo "This option will normally show the IP configuration of this machine" >> menuoutput.tmp;;
B) ping yahoo.com -c 4 >> menuoutput.tmp;;
C) echo "This option will normally do a Trace Route back to Yahoo.com" >> menuoutput.tmp;;
D) echo "This option will normally allow user to manually change the IP configuration on this machine" >> menuoutput.tmp;;
E) echo "This option will normally log you out of the system" >> menuoutput.tmp
esac
 
Old 06-22-2005, 06:30 PM   #9
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
WOO HOO... I have made alot of head way today on this script.... i was able to direct the results into a temp file and then pull them back up on the screen using the dialog command... and then to make it loop I just pause (read command) and then call the script back up ... a few more final adjustments and then I will start worrying about security.... Thanks for everyones help so far ... I will keep you posted and let you know when I am finished... I think this is very useful if you have a server in a data center that you can't get to it through the web for some reason... anyway ... just my thoughts
 
Old 06-23-2005, 04:37 PM   #10
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
Ok here is what I think to be the final for this script ....

Things to know ... there are a few files that the script refers to that you will need to create
To accomplish what I wanted it to do I created a new user with very few rights ... and pointed to this script file in their home directory for their shell. The only 2 options that accually have their commands in them are 2)Ping and 5)Exit ... so if you use this script you will need to replace the echo commands with the accual commands... I wrote this on a Mandrake box and will be moving it to a RedHat box soon... some of the commands are different... anyway

This seems to work good so far:


#!/bin/bash
#
#This is a limited user menu
#
#Menu creation
dialog --backtitle "Menu for running dianostics on this CLS" --title "Main \
Menu" --menu "Move using [UP], [DOWN], and [Enter] to \
Select " 15 67 5 \
IFConfig "Shows the IP Configuration of this CLS" \
Ping "Pings Yahoo.com" \
TraceRoute "Does a traceroute to the CMS" \
NetConfig "Manually Set the IP information" \
Exit "Logs out of the CLS" 2>/tmp/clsmenuitem.$$


clsmenuitem=`cat /tmp/clsmenuitem.$$`

opt=$?


case $clsmenuitem in
IFConfig)
date > outputtext.tmp
echo "This option will normally shows the IP configuration \
on this server" >> outputtext.tmp
cat outputtext.tmp >> menuoutput.tmp
dialog --title "Show IP Configuration" --backtitle "Menu for running dianostics on this CLS " --textbox outputtext.tmp 15 60;;

Ping)
date > outputtext.tmp
ping yahoo.com -c 4 >> outputtext.tmp
cat outputtext.tmp >> menuoutput.tmp
dialog --title "Ping Yahoo.com" --backtitle "Menu for running dianostics on this CLS " --textbox outputtext.tmp
20 92;;

TraceRoute)
date > outputtext.tmp
echo "This option will normally do a TraceRoute back \
to the CMS" >> outputtext.tmp
cat outputtext.tmp >> menuoutput.tmp
dialog --title "TraceRoute" --backtitle "Menu for running dianostics on this CLS " --textbox outputtext.tmp 15 60;;

NetConfig)
date > outputtext.tmp
echo "This option will normally allow the user to manually \
set the IP information on this CLS" >> outputtext.tmp
cat outputtext.tmp >> menuoutput.tmp
dialog --title "Manual IP Configuration" --backtitle "Menu for running dianostics on this CLS " --textbox outputtext.tmp 15 60;;

Exit)
date > outputtext.tmp
echo "Thank You for Using CommLogix!" >> outputtext.tmp
cat outputtext.tmp >> menuoutput.tmp
dialog --title "EXIT" --backtitle "Menu for running dianostics on this CLS " --textbox outputtext.tmp 7 35
exit;;
esac

./clstestmenu.sh

exit 0


OK well thank for all your help on the different threads.. thoughts are welcome!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Load kde profile from /mnt/removable/user instead of /home/user preacher.ca Linux - General 3 12-02-2005 04:00 PM
user profile ust Linux - Software 1 10-04-2005 08:01 AM
login screen...GUI not boot for a user linux_blnk182 SUSE / openSUSE 2 01-04-2005 01:45 PM
rh9 user profile pld Linux - Software 0 07-30-2003 09:43 PM
user profile nautilus_1987 LQ Suggestions & Feedback 2 09-01-2002 05:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration