D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Separate Home Partition

 

On Sat, 7 Sep 2013, Tom wrote:

To change UID and GID the hard way:
find /home -mount -user UID -exec chown newuser {} \;
find /home -mount -group GID -exec chgrp newgroup {} \;

From the more than one way to do it department:

you could use find ... -print0 | xargs -0 ... here...

(Although the 0 options are probably superfluous as you typically don't have usernames with spaces in)

Or, if directory names in /home correspond to the usernnames in /etc/passwd and group names in /etc/group, (fairly typical these days) then:

cd /home
foreach f (*)
  chown -R $f.$f $f
end

Or if you want it in bash, then:

for f in *; do chown -R $f.$f $f ; done

Gordon

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq