Giving others execute privileges


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Giving others execute privileges
# 8  
Old 01-18-2006
The first line is:

#!/usr/bin/sh

and just to see that it's there:

$ls -la /usr/bin/sh
-r-xr-xr-x 2 bin bin 208896 Oct 3 2004 /usr/bin/sh


Any ideas what I'm doing wrong??

Thanks for the help!
# 9  
Old 01-18-2006
In order for your shell to execute a script, it has to be able to read it during the execution - it is parsed, not compiled.

There are a few work arounds... You can use the setuid bit, so that anyone that executes it, does it as you (or a general account) that owns the file. For example, if I have a shell script that echos "It works":

Code:
# chmod 4501 ick
# ls -l ick
-r-s-----x   1 myuser mygroup 22 Jan 18 17:03 ick
# su - notmyuser
$ ./ick
It works!

The users can now execute the sciprt, but will not be able to view it. You could also limit it to a group instead of having the other bit be executable. The bad thing is that the script then executes as you - a reason a general account might be better for ownership of the file.

If you are using Solaris, you can use profile shell and the /etc/security/* files to setup a better option - I'll cover that if you are actually using Solaris.

Cheers,

Keith
# 10  
Old 01-19-2006
If the process cannot read the file, how can the process execute?
# 11  
Old 01-26-2006
Actually I'm building this example on HP-UX.

You mention that the files are parsed, not compiled. Is it possible to compile a shell script so that they can only view and execute the compiled code, not the actual source code?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

X11 privileges

Hi What privileges I need to install X11? Or, in other words, can I install X11 without root privileges? The only user that installed X11 will use it. If it depends on OS version, here is the list of operating systems: Linux Red Hat Enterprise AS/ES 4.0/4.5/5 ... (1 Reply)
Discussion started by: lleontiev
1 Replies

2. Shell Programming and Scripting

Privileges like root

My English is no very good. I must make a bash scripting sh create like a backdoor, and when execute the script a user without privileges convert in super user or root, whithout introducing the password. In Spanish: Crear un script que sirva como puerta trasera al sistema, de manera que al... (1 Reply)
Discussion started by: kitievbr
1 Replies

3. Shell Programming and Scripting

How to execute a script without giving x permission to the file?

How to execute a script with out giving x permission to the file? (7 Replies)
Discussion started by: praveen_b744
7 Replies

4. Web Development

no privileges in phpMyAdmin

Salamo Alikom i had install MySQL 5.1.33 binary version for FreeBSD ,when i logging to phpMyAdmin as root i see no privilege to create database ,how can i solve this problem ? (1 Reply)
Discussion started by: SIFE
1 Replies

5. AIX

copy a fs with the same privileges

Hi All, I use "cp -R /fs/* /newfs" and I can copy everything except it won't have the files/directories the same privileges. Is there a trick to this without using a software-backup. Thanks in advance, itik (3 Replies)
Discussion started by: itik
3 Replies

6. UNIX for Dummies Questions & Answers

root privileges

Hello, As admin with root rights, to execute any command from another user without password-ask, I do : su - <user> -c "<cmd>" But how can I do to give the same rights to another physical user without using root user ? :confused: I've try to create another user "toor" with the same primary... (4 Replies)
Discussion started by: madmat
4 Replies

7. UNIX for Dummies Questions & Answers

ACL vs privileges

Hello genius..! what do y'all think of these questions...? help appreciated...! Access Control Lists and privileges.... # Why both file ACLs and user permissions/privileges (not to be confused with rights in ACLs) are used in Windows access control (why not just use one of these)? # In... (1 Reply)
Discussion started by: heroine
1 Replies

8. Programming

root privileges

Hi I have make a program that needs root privleges but any user can try to run it, so what I want it is, when any user tries( other than root ) to run the program, an input prompt would open to enter root password ( if user knows ) and program will run ( otherwise exit ), and after completing... (21 Replies)
Discussion started by: sumsin
21 Replies

9. UNIX for Dummies Questions & Answers

privileges

I have a website that I am working on and one of the pages allows people to upload pictures to be used on other pages. My question is: is it safe to set the privileges to 777 on the folder that the pictures are saved in? Or would that open up my site to be hacked, bugged, wormed...and everything... (1 Reply)
Discussion started by: paladaxar
1 Replies

10. UNIX for Advanced & Expert Users

User Privileges

I have used several Linux Flavors and now I need to know something. I have the ROOT user and then I have my personal user. What I need to do is for my normal user to be able to write files to directories where appearntly, only the root user has privileges. For example, to write files to... (1 Reply)
Discussion started by: gdboling
1 Replies
Login or Register to Ask a Question