Link to home
Start Free TrialLog in
Avatar of MaRiOsGR
MaRiOsGRFlag for Greece

asked on

chmod -rw-rw-rw- to srw-rw-rw-

The question is simple.

I have these to files:
-rw-rw-rw-  1 popuser root          0 Nov 18 11:26 spamd_full.sock
-rw-rw-rw-  1 popuser root          0 Nov 18 11:26 spamd_light.sock

and I want to change them with the permissions like these 2:

srw-rw-rw-    1 popuser  root            0 Aug 22 11:29 spamd_full.sock
srw-rw-rw-    1 popuser  root            0 Aug 22 11:29 spamd_light.sock


so I did chmod 666 spamd_*
but the problem is how do I give the "s" before "rw" ?

Avatar of ravenpl
ravenpl
Flag of Poland image

there's no such permission setting like srw-rw-rw
Please explain what You want?
to set suid bit: chmod +s spamd_* # use -s to remove
to set sgid bit: chmod +S spamd_*
to set sticky bit: chmod +t spamd_*
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yuzh
yuzh

To change the filse permission from
-rw-rw-rw-  1 popuser root          0 Nov 18 11:26 aa

to
-srw-rw-rw-  1 popuser root          0 Nov 18 11:26 aa

to need to do:
chmod u+x aa
chmod u+s aa

where aa is the filename

man chmod
to learn more details.

Please note that there is security risk for script to use suid, please read the following docs to learn
more details about SUID:
http://www.unix.org.ua/orelly/networking/puis/ch05_05.htm
http://www.samag.com/documents/s=1149/sam0106a/0106a.htm
question is about  srw- not -rws , -srw does not exist, see ravenpl's comment also.
Monday morning .. everywhere ... ;-)
I assume MaRiOsGR wants to suid to the owner/user.

It is dangerous to have a file suid and it is world read/writable, some one can modify the script
to do whatever to the system!!!
> It is dangerous to have a file suid and it is world read/writable, some one can modify the script
Rather if it will overwrite the script with some binary. Scripts are not affected by suid bit, but You surely can
cat /bin/bash > /path/to/suid/scipt
MaRiOsGR:

The first letter in the permissions display indicates what type of file it is - what you are asking is how to make a socket (that's what the "s" stands for).  The "s" in any other position than the first would indicate a permissions issue and I believe all the experts above have addressed that.  But if you <really> want to create a socket, that's accomplished programmatically... and you should consider posting your question in one of the programming forums.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh, BTW, the socket will be removed when the system is normally closed
by spamd.