Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

chmod u+s FileName

Status
Not open for further replies.

jestrada101

Technical User
Mar 28, 2003
332
What exactly does "chmod u+s FileName" do? Does this allow anyone to execute the script?

thanks
JE
 
Use chmod +x FileName to allow anyone to excute the script.

Cheers,
Dan
 
what is the difference between the two?

Thanks
JE
 
In your case, chmod u+s is setting a sticky bit. Which is used to prevent file being removed or renamed from a directory. You can say that is file safety.
eg.
ls -l
rw-r--r-- ....... file1
chmod u+s file1
ls -l
rwsr--r-- ....... file1

If anyone want to delete the file, one or more conditions must be met for a user to delete file.
1. user own the file.
2. user own the directory
3. user can write the file.
4. root privilege.

chmod +x is used to enable the executable right to all users.

So, the first one related to file safety and the second one related to file accessibility.

tikual
 
Well, I think
Code:
chmod u+s
set the set user id bit and not the sticky bit (set by
Code:
chmod +t
).
It means that any user executing FileName will have the file owner id as effective user id (only during the execution).
The user must also have right to execute the file. (
Code:
rwsr-xr-x
)

"When all else has failed, read the manuals."

Denis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top