Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm creating directories and changing the permissions of them in perl with the following code:

umask 0000;
mkdir $path, 0770;
chown $userid, $groupid, $path;

Now when I do ls -l on a directory I've just created, they are as follows:

drwxrws---  2 user group 4096 Nov  3 15:34 test1

I notice for the group permissions, there's an s instead of x. Even if I chmod manually to remove all permissions for the user and group ("chmod g=" and "chmod u=", it's still there:

d-----S---  2 user group 4096 Nov  3 15:36 test2

The internet suggests S means everything in the folder is run as su or something? I don't quite understand what it means but I figure I should understand seeing as these are webroots so if there's a security implication, I ought to be aware of it.

Many thanks for your help!

share|improve this question

migrated from stackoverflow.com Nov 4 '12 at 0:35

This question came from our site for professional and enthusiast programmers.

    
This is not a programming question, thus it is off-topic. –  Oded Nov 3 '12 at 16:21
    
I did wonder. Which site do you suggest it should go instead? I was thinking serverfault but then I figure it's not really a sysadmin question either –  penguin Nov 3 '12 at 16:22
    
unix? –  Oded Nov 3 '12 at 16:22
    
OK thanks. I wasn't aware of that site. –  penguin Nov 3 '12 at 16:24
    
Look at the footer - all non-beta sites are listed. –  Oded Nov 3 '12 at 16:31
add comment

3 Answers

up vote 5 down vote accepted

s means the setgid/setuid bit and the executable bit both are set

S means only the setgid/setuid bit is set

check out man chmod for more information.

share|improve this answer
add comment

This is happening because of the umask value you're setting.

The internet suggests S means everything in the folder is run as su or something?

That is incorrect.

If the setuid bit is set on an executable program, then it will execute with the privileges of its owner.

If the setgid bit is set on the executable program, then it will execute with the permissions of its group.

So, don't go around creating things as root:root with umask 0000.

Better yet, don't ever set that to your umask.

See here: http://linuxzoo.net/page/sec_umask.html

The number given as a parameter to the umask command works in a opposite manner to the number given to the chmod command. The 'mask' serves to remove permissions as opposed to granting them.

share|improve this answer
add comment

In a way, it indicates an "error":

There is no point in setting the setuid bit, if the executable bit is not set.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.