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" ?

Who is Participating?
Oh - I guess You want change the regular file into socket - no way. The spamassasing have to create it by itself. You can just remove the file, so there's room for the socket.
If You insist, I can provide You perl one-liner to create sockets
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_*
To change the filse permission from
-rw-rw-rw-  1 popuser root          0 Nov 18 11:26 aa

-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:
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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

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.
nociSoftware EngineerCommented:
probably the next should work:

Add the following option to your spamd start script:

spamd --socketpath=/whatever/the/path/spamd_full.sock   {other options}
spamd --socketpath=/whatever/the/path/spamd_light.sock  {other options}

Also consider: --socketowner=popuser --socketgroup=root --socketmode=666
nociSoftware EngineerCommented:
Oh, BTW, the socket will be removed when the system is normally closed
by spamd.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.