Score:0

Why Did File Owner Change?

sd flag

Ubuntu Server 22.04 Encountered the following problem during a Linux class:

First lesson: User Management:

sudo useradd -m kaylee

sudo passwd kaylee

su - kaylee

Exited user kaylee, and started the next lesson (compiling source code):

  104  ll
  105  wget https://ftp.gnu.org/gnu/hello/hello-2.5.tar.gz
  106  ll
  107  sudo mkdir /usr/share/hello
  108  sudo cp hello-2.5.tar.gz /usr/share/hello/
  109  cd /usr/share/hello/
  110  ll
  111  tar -xzvf hello-2.5.tar.gz
  112  sudo tar -xzvf hello-2.5.tar.gz
  113  ll

Problem: the extracted files are owned by user kaylee:

total 576
drwxrwxrwx 10 kaylee root   4096 Feb  7  2010 hello-2.5/
-rw-r--r--  1 root   root 582535 Apr 15 15:09 hello-2.5.tar.gz

Why would the sudo tar command apply the user kaylee to the extracted files when I ran the sudo as my own user 'jfenner'???

vanadium avatar
cn flag
Try again and make sure you effectively exited the account of user kaylee? Nothing in your output suggests you effectively were not anymore acting as that user. So try again, and make sure first.
David avatar
cn flag
Please not as a comment. If this is the answer to the question you use the Answer Your Own question feature at the bottom of the question and add the answer.
Score:-1
sd flag

Solved:

Initially, I created a new user named kaylee with UID 1001

I downloaded the tarball from gnu.org with the embedded files owned by user UID 1001:

jfenner@ubuntu:~/pkg$ tar -tzvf hello-2.5.tar.gz 
drwxrwxrwx 1001/0 0 2010-02-07 17:15 hello-2.5/ 
-rw-r--r-- 1001/0 587 2006-11-09 19:53 hello-2.5/AUTHORS 

During the extraction from the tar, tar preserved the file owner of UID 1001. The system then properly correlated the UID 1001 to login name kaylee.

Organic Marble avatar
us flag
That's not an answer. It just restates who the user was.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.