# V-restore-user creates a new user with /home/user owned by root

**URL:** <https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291>\
**Category:** Uncategorized\
**Created:** [December 19, 2022, 12:20am UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291 "2022-12-19T00:20:23Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![cottager](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cottager](https://forum.hestiacp.com/u/cottager)\
**Post date:** [December 19, 2022, 12:20am UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/1 "2022-12-19T00:20:24Z")

</div>

Is this a bug?

I’m restoring from a vestacp archive using

> v-restore-user username username.DATE.tar

Seems to all run fine except the new user’s home dir created has owner of root:root instead of username:username

as in /home/username

I only noticed this because I was using vim to edit some scripts for new paths and was getting errors about temp files or writing files in the user dir.

---

<div class="post-metadata">

**Author:** ![cottager](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cottager](https://forum.hestiacp.com/u/cottager)\
**Post date:** [December 19, 2022, 12:34am UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/2 "2022-12-19T00:34:26Z")

</div>

Further to this.

I just created a new temporary user, and it also was created with root:root as owner for /home/temporary

I have older user accounts I created when I first set this server up, and they were as I would expect. i.e. thatuser:thatuser for ownership. Now they’re being created with root:root.

same bug different place? I can’t see a reason we’d want to create the user home dir with root ownership on purpose. This must be a bug.

---

<div class="post-metadata">

**Author:** ![cottager](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cottager](https://forum.hestiacp.com/u/cottager)\
**Post date:** [December 19, 2022, 12:44am UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/3 "2022-12-19T00:44:42Z")

</div>

Further to:

It seems on purpose, as when I change from ssh access from nologin to choosing a shell, it changes the home dir ownership. And it goes back to root ownership when I change ssh back back to nologin.

I guess this is seen as some extra security? I’m not sure what the benefit would be. I ran into this because I went from root user to the user for a particular website to edit and test scripts as that user. I was getting vim errors with the temp file creation. I hope someone might be able to explain the benefit.

cheers,  
Lane

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [December 19, 2022, 6:14am UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/4 "2022-12-19T06:14:11Z")

</div>

That is all normal. SFTP jail requires the folder to be owned by root other wise it will not work

---

<div class="post-metadata">

**Author:** ![cottager](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cottager](https://forum.hestiacp.com/u/cottager)\
**Post date:** [December 19, 2022, 12:53pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/5 "2022-12-19T12:53:04Z")

</div>

Ah. sftp jail. I wasn’t aware root had to own the user home dir for this. Thanks for explaining the why. Perhaps I can change permissions on the vim temp file to resolve that error when creating new files as the user instead of root.

Or I can create my files as root and later change their ownership to the user. You know, like a caveman! 😛

Anyway, thanks again for clarifying that.

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [December 19, 2022, 1:13pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/6 "2022-12-19T13:13:22Z")

</div>

Yes you can we do the same…

---

<div class="post-metadata">

**Author:** ![jlguerrero](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/jlguerrero/32/954_2.png) [@jlguerrero](https://forum.hestiacp.com/u/jlguerrero)\
**Post date:** [December 19, 2022, 2:01pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/7 "2022-12-19T14:01:38Z")

</div>

Oh my god! I was looking everywhere what could be happening… What was changing the ownership…

I thought it was one of my deployment or restoration scripts.

---

<div class="post-metadata">

**Author:** ![jlguerrero](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/jlguerrero/32/954_2.png) [@jlguerrero](https://forum.hestiacp.com/u/jlguerrero)\
**Post date:** [December 19, 2022, 2:03pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/8 "2022-12-19T14:03:57Z")

</div>

> [@cottager](#):
>
> And it goes back to root ownership when I change ssh back back to nologin.

This should not happen. Ownership should be restored to its original state or otherwise CMS maintenance could stop working.

At least it should be user:root

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [December 19, 2022, 2:55pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/9 "2022-12-19T14:55:46Z")

</div>

v-add-user-composer does it for example. So it is fine …

---

<div class="post-metadata">

**Author:** ![jlguerrero](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/jlguerrero/32/954_2.png) [@jlguerrero](https://forum.hestiacp.com/u/jlguerrero)\
**Post date:** [December 19, 2022, 4:14pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/10 "2022-12-19T16:14:22Z")

</div>

That means that everything is working as it is supposed to be or that it is very easy to patch that?

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [December 19, 2022, 4:18pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/11 "2022-12-19T16:18:58Z")

</div>

There is no bug in this case it works as expected…

When SFTP jail is enabled the user home dir needs to be owned by the root

---

<div class="post-metadata">

**Author:** ![jlguerrero](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/jlguerrero/32/954_2.png) [@jlguerrero](https://forum.hestiacp.com/u/jlguerrero)\
**Post date:** [December 19, 2022, 4:26pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/12 "2022-12-19T16:26:16Z")

</div>

and when you disable it?

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [December 19, 2022, 4:48pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/13 "2022-12-19T16:48:09Z")

</div>

Then it changes back to user:user

---

<div class="post-metadata">

**Author:** ![system](https://forum.hestiacp.com/uploads/default/original/1X/d9a5b68bf50ced83e880b56452e592b204761b19.png) [@system](https://forum.hestiacp.com/u/system)\
**Post date:** [January 18, 2023, 4:48pm UTC](https://forum.hestiacp.com/t/v-restore-user-creates-a-new-user-with-home-user-owned-by-root/8291/14 "2023-01-18T16:48:39Z")

</div>

Closed on January 18, 2023, 4:48pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
