Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 2017 18:25:36 +0300
From:      Anthony Pankov <ap00@mail.ru>
To:        freebsd-hackers@freebsd.org
Subject:   using rc.subr only by root restriction
Message-ID:  <1599987034.20170623182536@mail.ru>

index | next in thread | raw e-mail

Greetings

I  was  deploying  my  new  system  based  on  FreeBSD 11 and got ô
surprise.
I have specific subsystem which use own startup scripts tied to rc.subr
for better integration. Those  scripts  can  be  used  not  only  by system startup but also by
unpriveleged user.
With  FreeBSD  11 in case of unpriveleged user the error appear:  "limits:
setrlimit datasize: Operation not permitted"

There is a thread on a forum about the issue: https://forums.freebsd.org/threads/58304/

I've  never  seen a warning  to do not use rc.subr in regular scripts so I
made it this way.

May    be    we   can  consider  to  patch  rc.subr  and  remove  this
restriction?



P.S. This patch helps, but may be there is a better way.
--- /etc/rc.subr.old    2017-06-21 07:11:39.716210000 +0300
+++ /etc/rc.subr        2017-06-21 07:18:21.215444000 +0300
@@ -1072,7 +1072,9 @@
                        fi

                                        # Prepend default limits
-                       _doit="limits -C $_login_class $_doit"
+                       if [ `id -u` -eq 0 ]; then
+                               _doit="limits -C $_login_class $_doit"
+                       fi

                                        # run the full command
                                        #


-- 

 Anthony Pankov                          mailto:ap00@mail.ru



help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1599987034.20170623182536>