Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permissions

Status
Not open for further replies.

Sekhar

MIS
Sep 25, 2000
59
US
Once I change owner, can I know old owner of a file in UNIX? If yes,how?
[sig][/sig]
 
To view the owner of a file, use the "-l" option with "ls". For example:
[tt]
$ ls -l dead.letter
-rw-r--r-- 1 andyb other 2764 Aug 25 16:55 dead.letter
[/tt]
The file is owned by "andyb" and belongs to the group "other". Only two people can change the ownership of the file - "andyb" and "root". This can change, depending upon the permissions on the directory the file is in, so you may need to experiment.

To change the owner of the file use "chown new_owner filename(s)". For example:
[tt]
# Change ownership of a single file.
chown franks dead.letter

# Change ownership of many files.
chown franks /home/franks/projects/*
[/tt]
Hope this helps. [sig]<p> Andy Bold<br><a href=mailto: > </a><br><a href= > </a><br>"I've probably made most of the mistakes already, so hopefully you won't have to..." Me, most days.[/sig]
 
Sekhar,

I have not heard of a method of determining the previous owner of a file.

If you have a tar copy of the file then check the tar with tar tvf file.tar, the result should look like this: -

-rwxrwxrwx 1006/1 1167 Sep 7 12:12 2000 tester

The first number after permisions is the uid, grep the uid from /etc/passwd and you will get the user name. [sig]<p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>Top man[/sig]
 
Hi askewged,
Thanks for the advice. That's a good idea to check the backup.
But it seems AndyBo did not get my point.

Sekhar. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top