Can I change the ownership of all the files of a specific user?
Is there a way to recursively find all files owned by a user and change them to another user/group in Gnu/Linux?
I assume there must be some magic one liner but my command line wizardry skills are not up to that
Thanks!
Use the find command with the -user option. Something like:
find / -user john
will eventually turn up all files owned by user “john”.
If you want to change their ownership (I would run the find without execution to make sure you have the list you want), then something like:
find / -user john -exec chown harry {} \;
will do it.
Check more discussion of this question.
Related posts:
- Change ownership of directory and all contents to a new user from root
- Change ownership or permissions on only directories or files, recursively
- How do I find all files and directories writable by a specific user?
- Change user permissions on files/directories where user = fred recursively
- Force specific user for created files?
Leave a comment
Recent Posts
Tags
active-directory
amazon-ec2
apache
apache2
backup
bash
centos
cisco
command-line
debian
dns
email
exchange
firewall
iis
iis7
iptables
linux
macosx
monitoring
mysql
networking
nginx
performance
permissions
php
postfix
raid
security
sql-server
sql-server-2005
sql-server-2008
ssh
ssl
ubuntu
unix
virtualization
vpn
webserver
windows
windows-7
windows-server-2003
windows-server-2008
windows-server-2008-r2
windows-xp





