From 05b33ffb546ff18fba19b6ecd172ce1d6b178105 Mon Sep 17 00:00:00 2001 From: Martin Pärtel Date: Tue, 13 Mar 2012 17:09:15 +0200 Subject: Added root check for --map. --- src/bindfs.1 | 2 ++ src/bindfs.c | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/bindfs.1 b/src/bindfs.1 index 8a92246..b45b79d 100644 --- a/src/bindfs.1 +++ b/src/bindfs.1 @@ -63,6 +63,8 @@ right of a slash in the list of mappings. Currently, the options \fB--user\fP, \fB--group\fP, \fB--mirror\fP and \fB--create-for-*\fP override the corresponding behavior of this option. +Requires mounting as root. + .SH FILE CREATION POLICY New files and directories are created so they are owned by the mounter. diff --git a/src/bindfs.c b/src/bindfs.c index 24d4f53..897ae01 100644 --- a/src/bindfs.c +++ b/src/bindfs.c @@ -1429,6 +1429,10 @@ int main(int argc, char *argv[]) /* Parse usermap */ if (od.map) { + if (getuid() != 0) { + fprintf(stderr, "Error: You need to be root to use --map !\n", od.group); + return 1; + } if (!parse_user_map(settings.usermap, settings.usermap_reverse, od.map)) { /* parse_user_map printed an error */ return 1; -- cgit v1.2.3