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

diff --git a/phc2sys.8 b/phc2sys.8
index 45cb0e3..4fe1967 100644
--- a/phc2sys.8
+++ b/phc2sys.8
@@ -401,6 +401,14 @@ Same as option
 .B \-z
 (see above).
 
+.TP
+.B user
+The name of the user to which should
+.B phc2sys
+switch in order to drop the root privileges. By default,
+.B phc2sys
+will keep the identity of the user under which it is started.
+
 .SH TIME SCALE USAGE
 
 .B Ptp4l
diff --git a/phc2sys.c b/phc2sys.c
index 15f8d75..dc28287 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -1633,6 +1633,9 @@ int main(int argc, char *argv[])
                goto bad_usage;
        }
 
+       if (drop_root_privileges(config_get_string(cfg, NULL, "user")))
+               goto bad_usage;
+
        r = -1;
 
        if (wait_sync) {
-- 
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