Deleting a particular user files /userid
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > Deleting a particular user files /userid




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Deleting a particular user files /userid  
balreddy.gattu@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-22-06 12:22 AM

Hi,
Iam interetsed in learning Unix administration stuff.
Suppose a person left a company and we need to delete all his files.
How typically we can achieve this.
I think we can find all his files by using find command with -user
option.
Is there any better way to perform the same job?






[ Post a follow-up to this message ]



    Re: Deleting a particular user files /userid  
Dave Hinz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-22-06 12:22 AM

On 21 Jun 2006 11:42:36 -0700, balreddy.gattu@gmail.com <balreddy.gattu@gmail.com> wrote:[vb
col=seagreen]
> Hi,
> Iam interetsed in learning Unix administration stuff.
> Suppose a person left a company and we need to delete all his files.
> How typically we can achieve this.
> I think we can find all his files by using find command with -user
> option.[/vbcol]

Yes, and look at coupling that with -exec and xargs.

> Is there any better way to perform the same job?

Not that I know of, unless you count the above as "better".  You can do
this as a one-liner it'll just take a while to run.





[ Post a follow-up to this message ]



    Re: Deleting a particular user files /userid  
Kevin Collins


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-22-06 12:22 AM

In article <4ftjg0F1kjrv8U2@individual.net>, Dave Hinz wrote:
> On 21 Jun 2006 11:42:36 -0700, balreddy.gattu@gmail.com <balreddy.gattu@gm
ail.com> wrote: 
>
> Yes, and look at coupling that with -exec and xargs.

That should really be 'exec OR xargs'... 
 
>
> Not that I know of, unless you count the above as "better".  You can do
> this as a one-liner it'll just take a while to run.

Kevin

--
Unix Guy Consulting, LLC
Unix and Linux Automation, Shell, PERL and CGI scripting
http://www.unix-guy.com





[ Post a follow-up to this message ]



    Re: Deleting a particular user files /userid  
base60


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-22-06 12:22 AM

balreddy.gattu@gmail.com wrote:
> Hi,
> Iam interetsed in learning Unix administration stuff.
> Suppose a person left a company and we need to delete all his files.
> How typically we can achieve this.
> I think we can find all his files by using find command with -user
> option.
> Is there any better way to perform the same job?
>

That's generally what's done.





[ Post a follow-up to this message ]



    Re: Deleting a particular user files /userid  
Dave Hinz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-22-06 12:22 AM

On Wed, 21 Jun 2006 19:16:10 GMT, Kevin Collins <spamtotrash@toomuchfiction.com> wrote:[vbco
l=seagreen]
> In article <4ftjg0F1kjrv8U2@individual.net>, Dave Hinz wrote:[/vbcol]
 
>
> That should really be 'exec OR xargs'... 

Fair enough.  We're saying the same thing but diagraming the equation
differently, I think.







[ Post a follow-up to this message ]



    Re: Deleting a particular user files /userid  
Michael Tosch


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-22-06 12:22 AM

balreddy.gattu@gmail.com wrote:
> Hi,
> Iam interetsed in learning Unix administration stuff.
> Suppose a person left a company and we need to delete all his files.
> How typically we can achieve this.
> I think we can find all his files by using find command with -user
> option.
> Is there any better way to perform the same job?
>

Other users might continue to work with the files that are owned by
the user who has left.

You need a policy first.
A policy can e.g. say: leave the user's files in shared group/project
directories, but delete the personal files in the user's home directory.

--
Michael Tosch @ hp : com





[ Post a follow-up to this message ]



    Re: Deleting a particular user files /userid  
Stephane Chazelas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-22-06 12:25 PM

On Wed, 21 Jun 2006 19:16:10 GMT, Kevin Collins wrote:
> In article <4ftjg0F1kjrv8U2@individual.net>, Dave Hinz wrote: 
>
> That should really be 'exec OR xargs'... 
[...]

Actually, that should really be -exec AND NOT xargs, unless you
have one of those find/xargs variants that support -print0/-0 as
the GNU or recent BSD ones.

And you need to treat regular files and directories differently
(and use -depth), and if a directory that user owns contains
files owned by other users, you need to decide what to do (chown
root, chmod u-s for instance).

--
Stephane





[ Post a follow-up to this message ]



    Re: Deleting a particular user files /userid  
Doug Freyburger


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-23-06 12:23 AM

Dave Hinz wrote:
> balreddy.gattu@gmail.com wrote:
> 
>
> Yes, and look at coupling that with -exec and xargs.

As you already posted s/and/or/.  I will add that learning "find" is
one of the best learning tasks a new sysadmin can do.  Binary
descent tree with algebraic groupings on the command line.
Wonderfull stuff.
 
>
> Not that I know of, unless you count the above as "better".  You can do
> this as a one-liner it'll just take a while to run.

For better I would add in getting most of the way there faster and
easier - Archive to tape and delete that user's home directory.  Most
of the owned files will be there and in the various tmp directories.
Outside of the various tmp directories I would not want to
automatically
delete any owned file.  I've had senior CAD users own an entire CAD
application, delete automatically by owner and kaboom.

Del home dir.  Autodelete out of tmp dirs.  Search without auto
del elsewhere.  Expect to find a few owned files in other home dirs
from trading files among users.






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:38 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register