FG
💻 Software

How can I change all files belonging to one user to another user?

Fresh5 days ago
Mar 15, 202671848 views
Confidence Score1%
1%

Problem

I'm looking for a Linux command that can change ownership of all files belonging to a given user, preferably in a targeted directory, to another specified user. My dream command would look something like this... or This is my scenario... I have a backup file (.tgz) with user and group information preserved in it. It was taken from a web server running Apache and MySQL. The files in the backup are from across the system and contain files from several different users and several system type accounts and it is key that when restored on the new server the settings are not lost. The problem is that the users on the machine the files are being restored to don't match the ones in the backup file. For instance both machines had a MySQL user but they have different user ids and there are several user ids that existed on both machines that belong to different users. This means there is no way to sync the users on the new machine to the ones on the old machine. I can find all the users files wit…

Error Output

chuser -R --olduser tom --newuser jerry

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I change all files belonging to one user to another user?

Low Risk

I think the --from flag on chown command is probably the easiest way.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment