-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi,
please compare:
sudo ./nosudo -u'#1000' /bin/bash -c "echo -e 'a\nb\nc\n'; echo -e 'a\nb\nc\n'; id -u; id -u;"with
sudo -u'#1000' /bin/bash -c "echo -e 'a\nb\nc\n'; echo -e 'a\nb\nc\n'; id -u; id -u;"Maby requoting can help?
#!/usr/bin/env bash
# https://blogs.gentoo.org/agriffis/2006/06/26/requoting_in_bash/
function requote {
declare arg
for arg; do
arg=$(printf '%q' "$arg")
printf '%s ' "${arg:-''}"
done
}
ARGS=$(requote "${@}")
eval "$ARGS"Usage:
./myscript.sh sudo -u'#1000' /bin/bash -c "echo -e 'a\nb\nc\n'; echo -e 'a\nb\nc\n'; id -u; id -u;"
For now, I've decided to use real sudo instead...
(Also: real sudo can run a command under any uid, while su needs a user with that uid to actually exist. That seems to be a limitation of su, though...)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels