LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-25-2006, 02:45 PM   #1
cramer
Member
 
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Rep: Reputation: 15
Bash Scripting and Webmin/Usermin


I am attempting to make bash scripts that are independent from the user who uses them. In order to do this I need to use the $HOME variables in my scripts. I want the scripts to be owned by the root user so that those running them can run them but not view the code itself.

The scripts would be run from the custom commands module in usermin and the $HOME variable should recognize that the usermin user is the one using the script, thereby making the $HOME varibale = /home/username. However this is not the case. It seems to think that the home directory for the webmin user is always /root, which it is not.

This might be due to the fact that the scripts are owned by Root but I have given read write and execute permissions to everyone, (chmod 777) and the scripts are placed in the /bin directory so that they can be run from anywhere. Is there anyway I can make it so that the scirpts cannot be viewed by the users, but can be run by them and have the $HOME variable be successfully recognized as the correct home directory path? ANY help appreciated.

**FYI: I have also tried using the ~/ instead of $HOME but to no effect.
 
Old 02-25-2006, 07:49 PM   #2
cramer
Member
 
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Original Poster
Rep: Reputation: 15
As an update: I have tried runing the scripts thru the terminal/SSH and they work as they should, so the problem is not with the scripts.
 
Old 02-25-2006, 09:10 PM   #3
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
> In order to do this I need to use the $HOME variables in my scripts.

Yup. That's normal.

> I want the scripts to be owned by the root user so that those running
> them can run them but not view the code itself.

You don't want the users to be able to *view* the code? To run
a script, the user has to be able to "read" the code (that is,
the Python/Perl/Bash interpreter has to read the file).

BTW, what's the output of `ls -l your_script`? That might help.
 
Old 02-25-2006, 11:04 PM   #4
cramer
Member
 
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Original Poster
Rep: Reputation: 15
Sorry, what I mean was that I do not want to allow the person access to the code of the script, but since they are using usermin this isn't a problem, sorry you can ignore that part.

As for the ls -l it is as follows:

Code:
-rwxrwxrwx    1 root     root           34 Feb 25 18:59 pgw
I think the problem is not within the script itself but somewhere between usermin telling the script what user is running it and that the script is owned by root thereby usermin thinks that $HOME = /root

Last edited by cramer; 02-25-2006 at 11:06 PM.
 
Old 02-26-2006, 10:19 PM   #5
cramer
Member
 
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Original Poster
Rep: Reputation: 15
Well, there is this checkbox that says "Use User's environment, and that seems to have done it" wow i fell real dumb right now.
 
Old 02-27-2006, 01:50 AM   #6
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
Don't feel dumb. What you were missing was not some fundamental GNU/Linux feature that everyone needs to know, but an arbitrary feature of some program called "usermin". Personally, I've never heard of this "usermin". I think webmin is a web-based admin tool, but I've never used it.
 
Old 02-27-2006, 05:50 PM   #7
cramer
Member
 
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Original Poster
Rep: Reputation: 15
Yep, now it's giving me some other problems, but I'll sort it out.
 
  


Reply



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
Bash scripting help (su ...) shwong Linux - General 1 11-02-2005 12:26 PM
BASH Scripting akilles Linux - Newbie 5 11-10-2004 07:26 PM
Bash scripting vinoth.ilango Solaris / OpenSolaris 6 10-29-2004 04:41 AM
BASH If-then-else Scripting Help xianzai Programming 4 10-29-2004 04:09 AM
is webmin for server and usermin for client setup emailssent Linux - Networking 2 09-14-2004 10:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:41 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
Open Source Consulting | Domain Registration