Operating System - HP-UX
1825570 Members
3268 Online
109682 Solutions
New Discussion

-rwsr-xr-x -> special permissions

 
SOLVED
Go to solution
Manuales
Super Advisor

-rwsr-xr-x -> special permissions

Hi, can you tell me how can i put next permissions ... i mean, i have a file with permissions as follows:
rwxr-xr-x
and i want have them as follows:

-rwsr-xr-x

i know that is something like sticky ...

Thanks !!!
Man.
13 REPLIES 13
Tomek Gryszkiewicz
Trusted Contributor
Solution

Re: -rwsr-xr-x -> special permissions

chmod u+x file
This is not a "sticky" -- this is suid, which means the program is executed as the file owner. Be careful on it, it is potentialy dangerous!

--
Grych
Tomek Gryszkiewicz
Trusted Contributor

Re: -rwsr-xr-x -> special permissions

chmod u+s file
This is not a "sticky" -- this is suid, which means the program is executed as the file owner. Be careful on it, it is potentialy dangerous!

--
Grych
Pete Randall
Outstanding Contributor

Re: -rwsr-xr-x -> special permissions

That, in fact, is the setuid bit. It allows the script to be run as the owner, usually used to allow someone root authority when executing the script. See "man chmod" for details.


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: -rwsr-xr-x -> special permissions

Hi Manuales:

Have a look at the manpages for 'chmod(1)'. There is a good explanation of the bit mapping there.

Regards!

...JRF...
Robert-Jan Goossens_1
Honored Contributor

Re: -rwsr-xr-x -> special permissions

Hi,

check the chmod man page.

# chmod 4755 file

Regards,
Robert-Jan
Manuales
Super Advisor

Re: -rwsr-xr-x -> special permissions


Hi ...

I executed:
chmod u+x prueba.txt

The result was:
-rwxrw-r--

how can i put "s" letter????

Thanks ... Man.
Ivan Ferreira
Honored Contributor

Re: -rwsr-xr-x -> special permissions

SUID - for directories, no effect. For files, the file is executed as the owner of the file instead of the user that runs the program.

SGID - For directories, the files creates in the directory, inherit the group ownershipd. For files the file is executed as the group owner of the file instead of the user that runs the program.

STICKY - For programs, depend of the Unix, for Directories, used on public directories, allows only the deletion of a file to root and the owner of the file.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
James R. Ferguson
Acclaimed Contributor

Re: -rwsr-xr-x -> special permissions

Hi (again) Manuales:

You are trying to set the 'setuid' bit. Do:

# chmod 4755 filename

(or):

# chmod u+s filename

...to what you currently have.

Regards!

...JRF...
Ivan Ferreira
Honored Contributor

Re: -rwsr-xr-x -> special permissions

SUID - chmod 4XXX filename
SGID - chmod 2XXX filename
STICKY - chmod 1XXX filename

Where XXX is the normal permissions that you want to establish, for example 750.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Manuales
Super Advisor

Re: -rwsr-xr-x -> special permissions

Thanks all !!!!

Have a good day !!!

:0)

Manuales ..
Tomek Gryszkiewicz
Trusted Contributor

Re: -rwsr-xr-x -> special permissions

Sorry my mistake, should be +s of course!
Manuales
Super Advisor

Re: -rwsr-xr-x -> special permissions


What does mean this permissiions: -rwsr-xr-x ?

Manuales.
James R. Ferguson
Acclaimed Contributor

Re: -rwsr-xr-x -> special permissions

Hi Manuales:

The "man" pages should be your nickname :-))

There is a wealth of informtion there, especially if you follow the "See Also" section at the bottom. In this case, if you look at 'chmod(2)' you can find explanations for what 'setuid', 'setgid' and 'sticky' bits do:

http://docs.hp.com/en/B2355-60127/chmod.2.html

In the case of the 'setuid' bit, when set for an executable file, the privilege of the file's owner is given to the process running the executable file.

That is, if 'root' owns the executable and you (a normal user) are allowed to execute the file, *and* the 'setuid' bit is on, then you gain 'root' privilege while running the executable.

Regards!

...JRF...