Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-26-2012, 10:04 AM   #1
Registered: Mar 2004
Location: Greece
Distribution: Debian
Posts: 345

Rep: Reputation: 31
Directory permissions

I am trying to configure correct permissions for smsd and nagios.

Nagios run a script and save the file in the directory /var/spool/sms/outgoing/ for further processing
smsd access the files for further processing.

The initial script runs as a "nagios" user and output file is owned by nagios user.
/var/spool/sms/outgoing/ has smsd:smsd permissions

Is there a way to force output file to inherit /var/spool/sms/outgoing/ directory permissions?

chmod +s /var/spool/sms/outgoing/
chmod g+s /var/spool/sms/outgoing/
dont seem to work...

Last edited by JJX; 11-26-2012 at 10:08 AM.
Old 11-26-2012, 10:30 AM   #2
LQ Newbie
Registered: Apr 2011
Location: Rio, Brazil
Distribution: Gentoo
Posts: 15

Rep: Reputation: Disabled
Can't you put this directory as nagios' using chown? If you can't, you can put nagios in smsd group.
Old 11-26-2012, 10:33 AM   #3
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Once try:
chmod g+xs /var/spool/sms/outgoing/
If it do not help, then mention what are permissions and group of output file. If group has all rights i.e. r, w, and x, then you can add user smsd to group of /var/spool/sms/outgoing/ after setting SGID on /var/spool/sms/outgoing/. So any newly added file to /var/spool/sms/outgoing/ will get same group as that of /var/spool/sms/outgoing/ has and smsd will be able to perform any actions on that output file.

Last edited by shivaa; 11-26-2012 at 10:39 AM. Reason: Info. added
Old 11-27-2012, 04:38 AM   #4
Registered: Mar 2004
Location: Greece
Distribution: Debian
Posts: 345

Original Poster
Rep: Reputation: 31
# ll /usr/local/bin/sendsms
-rwxr-xr-x 1 root staff 512 Nov 26 17:02 /usr/local/bin/sendsms

# ll -d /var/spool/sms/
drwxrwxr-t 7 smsd smsd 4.0K Nov  7 15:47 /var/spool/sms/

# ll /var/spool/sms/
total 28K
drwxrwxr-t 7 smsd smsd 4.0K Nov  7 15:47 .
drwxr-xr-x 6 root root 4.0K Nov  7 15:47 ..
drwxrwsrwx 2 smsd smsd 4.0K Nov 27 11:30 checked
drwxrwsrwx 2 smsd smsd 4.0K Nov 27 11:30 failed
drwxrwsrwx 2 smsd smsd 4.0K Nov 27 11:30 incoming
drwsrwsrwx 2 smsd smsd 4.0K Nov 27 11:35 outgoing
drwxrwsrwx 2 smsd smsd 4.0K Nov 27 11:30 sent

root@davinci:/usr/local/bin# ./sendsms +30123456789 test1

root@davinci:/var/spool/sms# ll /var/spool/sms/outgoing/
total 12K
drwsrwsrwx 2 smsd smsd 4.0K Nov 27 11:37 .
drwxrwxr-t 7 smsd smsd 4.0K Nov  7 15:47 ..
-rw------- 1 root smsd   21 Nov 27 11:37 send_MhlIZ8
The file created has group permissions from smsd but owner is root!
Can I force owner change to "smsd"?
Old 11-27-2012, 04:42 AM   #5
Senior Member
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,452

Rep: Reputation: 85
You should read about sticky bit, SUID, and SGID. You're currently using all three.

Last edited by fakie_flip; 11-27-2012 at 04:50 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory ownership or permissions inside another directory Slyfox696 Linux - Newbie 3 11-02-2012 03:14 PM
File permissions v. directory permissions Completely Clueless Linux - Newbie 7 07-09-2009 09:33 AM
New directory permissions Paulsuk Linux - General 3 05-18-2005 07:36 AM
getting a directory's permissions and creating a new one with the same permissions newbie1000101 Programming 1 04-10-2004 01:52 PM
write permissions for directory - not accidently move/deleted the directory linuxgamer Linux - Newbie 10 12-02-2003 04:04 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:33 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration