sjethvani
sjethvani

Reputation: 538

Amazon linux Ec2 instance shows uid/groupid as '1000' for some recently extracted files as , however I don't have such uid/gid in my etc/passwd file

TL-DR : I am seeing some directories/files owned by user/groupid as '1000' in my AWS linux EC2 having Amazon Linux AMI . However I don't have any user with this userid/groupid . I checked my etc/passwd file & didn't find any user with uid(1000) . Does any one having any idea on why I am seeing '1000' userid/groupid for these files ? PS : I haven't deleted any user on this ec2 instance . This is fresh ec2 Amazon linux AMI instance

Problem in detail

Recently I spawned an EC2 linux t2.micro instance having Amazon Linux AMI in it . I downloaded apache-zookeper (since I am working on setting up apache-drill on this instance & installing zookeper is one of prerequisite for it) , so yeah anyway I downloaded zoo-keeper zip file using curl in ec2-user's home directory

See downloaded tar.gz files here enter image description here

Now I went to /opt directory (cd /opt) & extracted above tar.gz file there using sudo tar -xzvf ~/apache-zookeeper-3.6.0-bin.tar.gz

Now going to that extracted directory of apache-zookeeper-3.6.0-bin & doing ls -ltrh , shows some directories owned by user & group called '1000' . I searched this user in my /etc/passwd , however I didn't find any user with uid (1000) .

What can be wrong here ? This is the fresh instance , I haven't deleted any user or some other stuff . I just did ssh to this instance downloaded apache-zookeeper-3.6.0-bin.tar.gz from internet , extracted that in /opt folder . Nothing else

enter image description here

Would appreciate if anyone can explain me the reason of seeing '1000' uid/groupid for these extracted files ?

Upvotes: 0

Views: 1778

Answers (1)

franklinsijo
franklinsijo

Reputation: 18270

tar preserves the ownership of the files while archiving and can retain that ownership on extraction.

When you extracted the tar file, as a root user (or with sudo), tar tried to preserve original user and group. And that user and group did not exist in your host, thus instead of names, uid and gid is displayed.

If you don't want to retain the ownership, pass -o or --no-same-owner option while extracting.

If extracted as non-root user, ownership is not retained.

Upvotes: 2

Related Questions