Re: Usermod -G failure without error

2021-01-19 Thread Kevin Chadwick
On 1/19/21 10:59 AM, Kevin Chadwick wrote:
> Sorry, I think that I must have ran groupadd first which brought users and
> groups IDs, out of sync.

Ok, after failing to reproduce it this morning;

With admin safely jumping to 1020,

I worked it out.

groupadd elansys
useradd admin
userdel admin
groupdel elansys
useradd admin
groupadd elansys

/etc/passwd
admin:*:1018:1018::/home/admin:/bin/ksh

/etc/group
admin:*:1019:
elansyssftp:*:1018:

Shoudl userdel remove the group too?



Re: Usermod -G failure without error

2021-01-19 Thread Kevin Chadwick


> For example, does 'admin' exist in /etc/passwd?  What does "grep elansyssftp
> /etc/group" return?

I had played a little. So it shows /bin/ksh and test user etc.

/etc/passwd
admin:*:1018:1018::/home/admin:/bin/ksh

/etc/group
admin:*:1019:
elansyssftp:*:1018:test

Sorry, I think that I must have ran groupadd first which brought users and
groups IDs, out of sync.

I am guessing, the elansyssftp group seems to have gotten the same ID as admin
user, so there is no point adding it and so returns without error?

The admin group is then marooned, I guess, so I broke the user namespace system.

I see that system groups without users have dedicated IDs, so my bad.

Is there anything to improve upon?

An informational message be printed in the case of the permission already being
facilitated? Obviously the return code 0 is correct.

Alternatively, maybe when you add a group without an ID, a warning?

Or perhaps a groupadd man page CAVEAT?

Or I could just pay ultimate attention to the numbers, in the future?



Usermod -G failure without error

2021-01-18 Thread Kevin Chadwick
When I run the following commands, the elansyssftp group isn't populated. Yet
using a differently named group seems to work. I seem to have been able to do
so, on two different systems.

useradd -m -s /sbin/nologin -p `cat /etc/ssh/ssh_host_ed25519_key.pub |
/usr/bin/encrypt -b a` admin
groupadd elansyssftp
usermod -G elansyssftp admin

Is this a bug, can anyone reproduce it or clear up my confusion?

Thanks, Kc