Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-18
9
Medium Priority
?
6,566 Views
Last Modified: 2012-05-05
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" ?

0
Comment
Question by:MaRiOsGR
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 43

Expert Comment

by:ravenpl
ID: 17971121
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_*
0
 
LVL 43

Accepted Solution

by:
ravenpl earned 1200 total points
ID: 17971130
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
0
 
LVL 38

Expert Comment

by:yuzh
ID: 17976562
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Expert Comment

by:ahoffmann
ID: 17977424
question is about  srw- not -rws , -srw does not exist, see ravenpl's comment also.
Monday morning .. everywhere ... ;-)
0
 
LVL 38

Expert Comment

by:yuzh
ID: 17977475
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!!!
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 17977554
> 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
0
 
LVL 6

Expert Comment

by:bpeterse
ID: 17981623
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.
0
 
LVL 40

Assisted Solution

by:noci
noci earned 800 total points
ID: 17999928
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
0
 
LVL 40

Expert Comment

by:noci
ID: 17999935
Oh, BTW, the socket will be removed when the system is normally closed
by spamd.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month7 days, 7 hours left to enroll

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question