Possible Yast2/Usermod Bug

Hi, everyone

This is my first post, please forgive any lack of clarity.

Background: System - Open SUSE 11.4. I’m a part-time network administrator for a small school, and I recently did a clean install of Open SUSE 11.4. As part of system configuration, it was necessary to install Firebird and change the UID/GID of the firebird user to match the UID/GID of an existing database file. I used “usermod -u <new UID> firebird” to change the UID, and then Yast2 to change the GID of firebird. Each of these operations took a long time to run, and later I discovered the reason why - every single file on all mounted systems had been changed to the new firebird UID and GID, without regard to whether the files “belonged” to firebird or not. It was as if I had done “chown -R <new firebird UID>:<new firebird GID> *” starting from / (I hadn’t, of course). Eventually I got the system back to a working state, mostly by setting everything to root:root with chown, and then dealing with the various cases where the system needed something different.

The man page for usermod says that it attempts to change the UID of the files in the home directory of the user whose UID is being changed. However, the firebird user is a system user and doesn’t have a home directory - so it looks as if usermod treated “/” as the home directory for firebird…

In future, I will avoid the use of usermod, certainly for system users, and try either editing passwd and group directly or using userdel and useradd (delete the firebird user, add a new firebird user with a selected UID/GID).

This is more in the nature of a bug report/warning than a request for help, although at one point last night I was tearing my hair out - I couldn’t even su to root! (Somehow the permissions on su had got changed to 0755 - changing them back to 4755 made su to root work again).

This is a followup to my previous post - not a bug, just computers doing what you tell them to do (as distinct from what you want).

The entry in /etc/passwd for firebird does in fact have “/” as the home directory. So usermod and yast did what they advertise - change all the files in the user’s “home directory”. Moral - before using usermod/yast to change UID or GID, check the entry in /etc/passwd to see which directories are affected.

JohnAfro wrote:
> This is a followup to my previous post - not a bug, just computers doing
> what you tell them to do (as distinct from what you want).
>
> The entry in /etc/passwd for firebird does in fact have “/” as the home
> directory. So usermod and yast did what they advertise - change all the
> files in the user’s “home directory”. Moral - before using usermod/yast
> to change UID or GID, check the entry in /etc/passwd to see which
> directories are affected.

So the bug is in the firebird installation not setting a sensible home
directory. How did you install firebird?

On 2012-04-30 12:36, JohnAfro wrote:

> The entry in /etc/passwd for firebird does in fact have “/” as the home
> directory. So usermod and yast did what they advertise - change all the
> files in the user’s “home directory”. Moral - before using usermod/yast
> to change UID or GID, check the entry in /etc/passwd to see which
> directories are affected.

Indeed…

Perhaps it is also a bug to set / as the home of anybody.

I have never used usermod, I prefer to edit /etc/passwd and change the
files myself. You gave me another reason for doing so :slight_smile:

I would in fact reconsider reinstalling, to make sure all permissions are
right. If that’s not possible, I would then do another similar install, and
create a script to redo the permissions in A as they are in B.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I’m confused on what you want to accomplish??? I do understand what you have done just not why you did it.

It seems to me is what you want is a group not a user. but…???

On 2012-04-30 17:16, gogalthorp wrote:
>
> I’m confused on what you want to accomplish??? I do understand what you
> have done just not why you did it.

Adapt the configuration of firebird to the existing files of that firebird
software, that belongs to a different uid/gid.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I installed firebird in the normal way, using yast and packages from the normal Open Suse 11.4 repositories - nothing strange or exotic. I needed to change both the UID and GID to match the pre-existing database file. The normal install process gives no way to control the UID and GID that the system gives out, and normally it doesn’t matter. This is a special case of two installed systems on the same server having access to the same database file. I couldn’t change the database file, because then the UID and GID would be wrong for the other system. I agree, it’s a flaw in the installation - a much more logical choice of “home directory” would be /var/lib/firebird. But I should have been more careful. It would be nice if there was a flag to turn off this automatic conversion in usermod, and/or a warning in Yast that “you are about to change username/group of all the files on the system - do you really want to do this?”:slight_smile:

Cheers, John

Regarding re-installing - doing what I did to recover was the quickest way in the circumstances. I’m going to upgrade to 12.1 fairly soon in any case, so that should fix any lingering ownership/permissions problems.

John

On 2012-05-01 23:26, JohnAfro wrote:
>
> I installed firebird in the normal way, using yast and packages from the
> normal Open Suse 11.4 repositories - nothing strange or exotic. I needed
> to change both the UID and GID to match the pre-existing database file.
> The normal install process gives no way to control the UID and GID that
> the system gives out, and normally it doesn’t matter. This is a special
> case of two installed systems on the same server having access to the
> same database file.

Ah, you have to operating system accessing the same database. I wondered
why not change the permissions of the files. That’s why.

> I couldn’t change the database file, because then
> the UID and GID would be wrong for the other system. I agree, it’s a
> flaw in the installation - a much more logical choice of “home
> directory” would be /var/lib/firebird.

Yes, and you can report that in bugzilla, and explain what happened.

> But I should have been more
> careful. It would be nice if there was a flag to turn off this
> automatic conversion in usermod, and/or a warning in Yast that “you are
> about to change username/group of all the files on the system - do you
> really want to do this?”:slight_smile:

It could have happened to anybody.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On 2012-05-01 23:26, JohnAfro wrote:
>
> Regarding re-installing - doing what I did to recover was the quickest
> way in the circumstances. I’m going to upgrade to 12.1 fairly soon in
> any case, so that should fix any lingering ownership/permissions
> problems.

You can also upgrade 11.4 to 11.4 - it works :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)