Debian Codegraph @

usrmnt.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # usrmnt.sh, written by Anthony Richardson
3 # Used in ABS Guide with permission.
4
5 # usage: usrmnt.sh
6 # description: mount device, invoking user must be listed in the
7 # MNTUSERS group in the /etc/sudoers file.
8
9 # ----------------------------------------------------------
10 # This is a usermount script that reruns itself using sudo.
11 # A user with the proper permissions only has to type
12
13 # usermount /dev/fd0 /mnt/floppy
14
15 # instead of
16
17 # sudo usermount /dev/fd0 /mnt/floppy
18
19 # I use this same technique for all of my
20 #+ sudo scripts, because I find it convenient.
21 # ----------------------------------------------------------
22
23 # If SUDO_COMMAND variable is not set we are not being run through
24 #+ sudo, so rerun ourselves. Pass the user's real and group id . . .
25
26 if [scip-shell system . . `[`. -z "$SUDO_COMMAND" ]
27 then
28 mntusr=$(idscip-shell system . . id. -u) grpusr=$(idscip-shell system . . id. -g) sudoscip-shell system . . sudo. $0 $*
29 exit 0
30 fi
31
32 # We will only get here if we are being run by sudo.
33 /bin/mountscip-shell filesystem . . `/bin/mount`. $* -o uid=$mntusr,gid=$grpusr
34
35 exit 0
36
37 # Additional notes (from the author of this script):
38 # -------------------------------------------------
39
40 # 1) Linux allows the "users" option in the /etc/fstab
41 # file so that any user can mount removable media.
42 # But, on a server, I like to allow only a few
43 # individuals access to removable media.
44 # I find using sudo gives me more control.
45
46 # 2) I also find sudo to be more convenient than
47 # accomplishing this task through groups.
48
49 # 3) This method gives anyone with proper permissions
50 # root access to the mount command, so be careful
51 # about who you allow access.
52 # You can get finer control over which access can be mounted
53 # by using this same technique in separate mntfloppy, mntcdrom,
54 # and mntsamba scripts.