Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello,
So i have the need to restrict the commands some users have on my Ubuntu server RC 6.06.
Lets say i just want them to use two scripts 'etrace' and 'eping'. No 'cd' no 'ls' nothing. I thought of using 'chmod' on directories in /bin. Can you please give me any suggestions?
Write a captive script or program that launches at login time (ie. put it in /etc/password/ per user). There are many ways of actually writing the script, ranging from a simple bash script (difficult to make bullet proof) to a full GUI written in a compiled language such as C.
There's also ways of restricting the shell itself (restricted bash, though it works with other shells too). The bash man pages or Google can tell you exactly how...
The intention it's not to make bullet proof. All i want it's to prevent the regular users form accesing any command and those who know what they do to be delayed so that i can notice what they're up to. Any suggestions on actualy how to write the script?
#! /bin/bash
while [ 1 ]
do
echo "Enter '1' or '2'"
echo 1. Program 1
echo 2. Program 2
read prognum
case $prognum in
1) echo launching Program 1
;;
2) echo Launching program 2
;;
*) exit
;;
esac
done
You need to flesh it out with your actual program names, more informative menu, etc. Make it executable, and name it in /etc/password as the 'shell' for appropriate users. Test it by executing from an ordinalry bash shell.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.