Tar changes folder ownership when run under root
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tar (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
I got locked out of my server via SSH, simply by extracting a tar file. No matter how crazy it sounds, it is reproducible.
1. login as root
2. wget https:/
3. tar -xjvf btop-1.
At this point the /root folder has ownership of user:user (1000:1000) and the root is locked out from SSH login. I had to fix the server via KVM.
auth.log contained the following:
"Authentication refused: bad ownership or modes for directory /root"
This seems to be a bug in tar, as the above behaviour doesn't happen when logged in under any non-root user.
With non-root users the directory does not change ownership.
With root user, no matter where I extract the tar file, the directory changes ownership.
---
lsb_release -rd
Description: Ubuntu 18.04.6 LTS
Release: 18.04
apt-cache policy tar
tar:
Installed: 1.29b-2ubuntu0.2
Candidate: 1.29b-2ubuntu0.2