Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>
---
 pmc.8 | 8 ++++++++
 pmc.c | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/pmc.8 b/pmc.8
index db472d3..81278f4 100644
--- a/pmc.8
+++ b/pmc.8
@@ -140,6 +140,14 @@ options. The name of the section is the name of the 
configured port (e.g.
 .B domainNumber
 The domain attribute of the local clock. The default is 0.
 
+.TP
+.B user
+The name of the user to which should
+.B pmc
+switch in order to drop the root privileges. By default,
+.B pmc
+will keep the identity of the user under which it is started.
+
 .SH PORT OPTIONS
 .TP
 .B transportSpecific
diff --git a/pmc.c b/pmc.c
index 440c905..c62b0a7 100644
--- a/pmc.c
+++ b/pmc.c
@@ -522,6 +522,11 @@ int main(int argc, char *argv[])
        print_set_syslog(1);
        print_set_verbose(1);
 
+       if (drop_root_privileges(config_get_string(cfg, NULL, "user"))) {
+               config_destroy(cfg);
+               return -1;
+       }
+
        pmc = pmc_create(cfg, transport_type, iface_name, boundary_hops,
                         domain_number, transport_specific, zero_datalen);
        if (!pmc) {
-- 
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to