SUID permission on Bash script

Polytropon freebsd at
Sat Aug 29 00:11:31 UTC 2009

On Fri, 28 Aug 2009 09:24:35 +0100, Jeronimo Calvo <jeronimocalvop at> wrote:
> content of script:
> ]#!/usr/local/bin/bash
This ] doesn't belong to the script, does it?

Furthermore, why do you employ bash for calling another program?
It's standard to use sh (#!/bin/sh) if you don't use bash-specific
commands and constructs, and I don't see them here. If you care
for portablility, such a script is an absulute no-go.

Furthermore, in order to perform

	shutdown -p now

it's more convenient to use the sudo command (from ports) and add
a rule (for maximum security) for the specific user who you want
to be able to run this command.

Finally, it's possible to place the user in question into the
group "operator", then he can perform the above command without
needing (1st) sudo and (2nd) bash. Look at the permissions of
the shutdown program:

	-r-sr-x---  1 root  operator  /sbin/shutdown*

Members of "operator" are +x for this binary.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list