diff options
author | Andy Zhou <azhou@nicira.com> | 2015-09-11 11:26:39 -0700 |
---|---|---|
committer | Andy Zhou <azhou@nicira.com> | 2015-09-30 20:43:46 -0700 |
commit | e91b927d8966bfcb9768225392324dde4fd7d7f6 (patch) | |
tree | 334d464fd03deaf90bb298124913851226fc8de1 /ovsdb | |
parent | 1bbebfb7afadac4adf209cf7f7ab69655479638b (diff) | |
download | openvswitch-e91b927d8966bfcb9768225392324dde4fd7d7f6.tar.gz |
lib/daemon: support --user option for all OVS daemon
OVS daemons can now support --user option to run as a non-root
user with less privileges.
See the manpage patch for more descriptions.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ovsdb')
-rw-r--r-- | ovsdb/ovsdb-client.c | 5 | ||||
-rw-r--r-- | ovsdb/ovsdb-server.c | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 575cf9187..b59388f6b 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,6 +91,7 @@ main(int argc, char *argv[]) parse_options(argc, argv); fatal_ignore_sigpipe(); + daemon_become_new_user(false); if (optind >= argc) { ovs_fatal(0, "missing command name; use --help for help"); } @@ -791,7 +792,7 @@ do_monitor(struct jsonrpc *rpc, const char *database, size_t n_mts, allocated_mts; daemon_save_fd(STDOUT_FILENO); - daemonize_start(); + daemonize_start(false); if (get_detach()) { int error; diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 4088d8544..0c34820de 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -221,6 +221,7 @@ main(int argc, char *argv[]) process_init(); parse_options(&argc, &argv, &remotes, &unixctl_path, &run_command); + daemon_become_new_user(false); /* Create and initialize 'config_tmpfile' as a temporary file to hold * ovsdb-server's most basic configuration, and then save our initial @@ -248,7 +249,7 @@ main(int argc, char *argv[]) save_config__(config_tmpfile, &remotes, &db_filenames); - daemonize_start(); + daemonize_start(false); /* Load the saved config. */ load_config(config_tmpfile, &remotes, &db_filenames); |