How to fix "chown: invalid group:" if the user does not exist on the running system?
145
Use the numerical UID/GID instead of the user/group name.
You can find the UID/GID on the system the disk belongs to by using
id some_username
or
ls -ln some_file
where some_file
is a file that belongs to user you are looking for
Related videos on Youtube
Author by
ssd
Updated on September 18, 2022Comments
-
ssd almost 2 years
Following code is supposed to return the upper case string of the source. It works but does not convert the string. Could not figure out what was wrong.
char *StrUpper (char *s) { int i = 0; char *t = &s [i]; while (*t) { if ((*t > 0x5a) && (*t < 0x7b)) t = (t - 32); t = &s [i++]; } return (s); } int main () { printf ("%s\n", StrUpper ("lower case string")); return (0); }
-
davmac almost 10 years'it works but does not convert the string' - surely this means it doesn't work?
-
Rahul Tripathi almost 10 yearsAlso to add that the reason why you say that it works is because you are getting an undefined behavior.
-
Unn almost 10 yearsIt might be good to mention that you're looking at the 0th element twice:
t = &s [i++]
might want to be replaced witht = &s [++i]
-
José Manuel Blasco over 2 yearsIn my case, I was using chown with $USER:(id -n $USER) that fills the group. But the group had whitespaces so I had to surround the group part. $USER:"(id -n $USER)" worked for me
-
-
ssd almost 10 yearsI've already tried that (*t = *t - 32) thing; in that case however, codeblock crashes like: Problem signature: Problem Event Name: APPCRASH ... Exception Code: c0000005
-
ssd almost 10 yearsJust tried your code above, codeblocks crashes like: Problem Event Name: APPCRASH Exception Code: c0000005
-
Vlad from Moscow almost 10 years@merkez3110 The problem is not with the function I showed. The problem with how you call it. For example you may not use string literals as arguments of the function.
-
ssd almost 10 yearsI've already tried the code below, no change: ` int main () { char *s = "lower case string"; printf ("%s\n", StrUpper (s)); return (0); }`
-
Some programmer dude almost 10 years@merkez3110 That's because
s
still points to the constant string literal. Instead dochar s[] = "...";
-
Vlad from Moscow almost 10 years@@merkez3110 See my updated post where there is an example of using the function.
-
ssd almost 10 yearsOK!
StrUpper ("blah blah");
andchar *s = "blah blah"; StrUpper (s);
does not work; butchar s [] = "blah blah"; StrUpper (s);
works. Thanks for everyone. As @JoachimPileborg noted, I was trying to crunch a string literal which is a const by def. -
This isn't my real name almost 10 yearsOddly enough, string literals are not const by definition, they are non-modifiable by definition. String literals are exceptional: they don't become arrays of
const char
type, they become arrays ofchar
type that you are nevertheless forbidden to modify.