Am 04.01.2017 um 20:54 schrieb David Haller:
Hallo,
Am Wed, 04 Jan 2017, Joerg Thuemmler schrieb:
Am 04.01.2017 um 10:05 schrieb Paul Neuwirth:
On Wednesday 2017-01-04 09:58, Joerg Thuemmler wrote:
user=`whoami` newfiles=`ls -1 *.JPG | tr '\n' ' '` for newfile in $newfiles do
Das fällt dir auf die Füße, wenn Leerzeichen etc. in Dateinamen auftauchen.
ja, ist klar. Sind Kamerabilder, haben nie Leerzeichen.
sudo chown $user.users $newfile
Speziell wenn du hier nicht quotest.
s.o.
[..]
Dass die /etc/sudoers wildcards unterstützt, würde ich stark anzweifeln, da dies eine riesige sicherheitslücke darstellen würde, hinter dem * könnte sich z.b. ein weiterer Befehl in backticks verbergen.
==== sudoers(5) ==== A Cmnd_List is a list of one or more commandnames, directories, and other aliases. A commandname is a fully qualified file name which may include shell-style wildcards (see the Wildcards section below). A simple file name allows the user to run the command with any arguments he/she wishes. However, you may also specify command line arguments (including wildcards). Alternately, you can specify "" to indicate that the command may only be run without command line arguments. [..] Wildcards sudo allows shell-style wildcards (aka meta or glob characters) to be used in host names, path names and command line arguments in the sudoers file. Wildcard matching is done via the POSIX glob(3) and fnmatch(3) routines. Note that these are not regular expressions. [..] Note that a forward slash ('/') will not be matched by wildcards used in the path name. When matching the command line arguments, however, a slash does get matched by wildcards. This is to make a path like:
/usr/bin/*
match /usr/bin/who but not /usr/bin/X11/xterm.
Exceptions to wildcard rules The following exceptions apply to the above rules:
"" If the empty string "" is the only command line argument in the sudoers entry it means that command is not allowed to be run with any arguments. ====
Bzgl. glob -> siehe 'man 7 glob'.
Danke für den Hinweis. Werd trotzdem drauf verzichten.
Egal, der workaround funzt ja.
Teste mal:
sudo sh -c 'chown *.JPG'
Würde mich wundern, wenn das nicht klappt. Die Shell drumrum brauchst du, weil chown den '*' ja nicht selber expandiert.
HTH, -dnh
Du hast - wie immer - den Punkt getroffen: bei "sudo chown" gibt es gar keine Shell, die Wildcards interpretieren könnte. Hätte ich mal drauf kommen können, dass hier ein binary ein binary aufruft ;-( Danke cu jth -- www.teddylinx.de -- Um die Liste abzubestellen, schicken Sie eine Mail an: opensuse-de+unsubscribe@opensuse.org Um den Listen Administrator zu erreichen, schicken Sie eine Mail an: opensuse-de+owner@opensuse.org