User disappear from panel after editing home dir

SYSTEM INFORMATION
OS type and version Debian Linux 12
Webmin version 2.202
Virtualmin version 7.20.2
Webserver version Apache version 2.4.62
Related packages SUGGESTED

Hello,
I am using Virtualmin and Virtualmin Pro and I am experiencing the following issue:

I have a specific project for which it is necessary for the FTP user to have access to one directory above the document root, which by default is always public_html.

I was not able to find information how to create an FTP user through the panel, which after login will be placed in the “/home/testdomain” directory instead of “/home/testdomain/public_html”.

In order to provide user access to a directory above public_html, I have to edit the default home directory of user (removing public_html dir) through the webmin menu.

webmin → users and groups → Select user and edit default home dir.

After that when user log via FTP have access above „public_html“.

Everything “looks fine” so far, but when these described steps are performed on a subdomain.
Тhe user whose default directory is edited (removed public_html) - user disappears from the „Edit Users“ menu in virtualmin.

I was able to reproduce this problem also on “pro” version of virtualmin panel.

If default home dir on user is edited again, restore public_html dir, user appear again in panel, but then he doesn’t have access one directory above public_html.

This only happens with users to a „subdomain“, I was not able to recreate it with a user who is part of a „top-level server“.

Is the described behavior expected, or is it a panel bug because it only occurs with users who are part of a subdomain?

by this do you mean a subserver of a toplevel domain or a subdomain created as a toplevel server as virtualmin can do either, if the former a quick fix is to convert the subserver to a toplevel server via the move server option in virtualmin

Subserver of a already created top-level domain.

„quick fix“ is not a variant because my client have absolute paths in his project.
If i try to convert subserver to a top-level server, panel change directory path. It removes directory „domains“ in which every subdomain is placed. This will broke the project.

A lot said for not hard coding directory paths into a project, for the simple reason you can deploy the project in any directory.

Don’t do it!

To keep it simple, why not just use existing main domain owner user for this purpose?

Because the main domain user (owner) has access to the live project.

Developers are different, we don’t want go give access to an already existing project, just the new subdomain.

Could you please share a more appropriate way by which I can achieve the described without editing default home dir?

Can you clarify what the extra user should do? You mentioned, “I was not able to find information on how to create an FTP user through the panel, which after login will be placed in the /home/testdomain directory instead of /home/testdomain/public_html” .

Do you want that extra user access files in /home/testdomain but not in /home/testdomain/public_html?

Why not create a user whose home directory will be in default ~/homes/?

No, as i describe i want user to have access one dir up from default root which is public_html dir.
Client want to create some directory and put files in which will use.

But when i achieve that via removing public_html from user default home path, user disappear from panel and that’s confusig bcs the same tactic work on top-level server.

I didn’t try to change proftp config file.
image

Just in case to confirm that i understand you right, you sugges to change this row in config file of proftp from „DefaultRoot ~“ to „DefaultRoot ~/homes/“

This is still a bit unclear, sorry. Do you want your client A to only be able to access /home/testdomain/client-a-dir? Is that correct?

yes that’s correct

In this case, you should click the “Add FTP User” button on the “Edit Users” page and then configure it as follows:

that’s will not work.
I didn’t understand clearly what you mean.

When user log, instead of seein’ this:

Using binary mode to transfer files.
ftp> ls -la
229 Entering Extended Passive Mode (|||56138|)
150 Opening ASCII mode data connection for file list
drwxr-x---   3 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:36 .
drwxr-x---   3 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:36 ..
-rw-r--r--   1 tesrk@dev.testdomain.tld testdomain    78228 Oct 10 06:35 index.html
drwx------   3 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:36 .usermin
226 Transfer complete
ftp> pwd
Remote directory: /

Should see this:

ftp> ls -la
229 Entering Extended Passive Mode (|||54981|)
150 Opening ASCII mode data connection for file list
drwxr-x---   9 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 .
drwxr-x---   9 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 ..
drwxr-xr-x   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 bin
drwxr-x---   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 cgi-bin
drwxr-xr-x   3 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 etc
drwxr-xr-x   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 homes
drwxr-x---   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 logs
drwxr-x---   3 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:36 public_html
drwxr-x---   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 tmp
226 Transfer complete
ftp> pwd
Remote directory: /

and here, client want to create desired directory via FTP and upload files.

This is exactly what the user should see and what happens by default. Unless something was manually changed incorrectly, this should be the case.

I just ran additional tests, and I’m confident it works as expected.

yea, you are wright.

Problem is when i remove „public_html“ from defaults user home dir and allow created FTP user to see and access this:

ftp> ls -la
229 Entering Extended Passive Mode (|||54981|)
150 Opening ASCII mode data connection for file list
drwxr-x---   9 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 .
drwxr-x---   9 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 ..
drwxr-xr-x   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 bin
drwxr-x---   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 cgi-bin
drwxr-xr-x   3 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 etc
drwxr-xr-x   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 homes
drwxr-x---   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 logs
drwxr-x---   3 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:36 public_html
drwxr-x---   2 tesrk@dev.testdomain.tld testdomain     4096 Oct 10 06:35 tmp
226 Transfer complete
ftp> pwd
Remote directory: /

User dissapear in „Edit Users“ menu in virtualmin

If it causes a problem, don’t create one. :wink:

Is this how you respond to every one of your customers who reports strange behavior of the product you offer?

We always do our best to help our users. In this comment, I gave you a straightforward answer, explaining how things should be done to reach your goal. I mentioned it works with the default Virtualmin setup and added, jokingly, that if custom configurations break stuff, it’s best to avoid them.

If you’re confident that your manual configuration is correct, just provide the exact steps to reproduce it, one by one, and we’ll take it from there. If English isn’t your first language, feel free to formulate your question in your native language and use AI to translate it into English. It’ll save time and effort for everyone.

Thanks!

I did that in first comment, but may you didn’t read it.

  1. Created a subdomain to an already existing main domain.
  2. Create a FTP user to this subdomain.
  3. Edit default home dir on this FTP user via Webmin menu or manually editing path in „/etc/passwd“ file. Just remove „public_html“ at the ent of path and save.
  4. Check in menu „Edit Users“ for this subdomain and see that user is not appearing.

This can be reproduced on a fresh panel installation

@rtk Clear! Thanks!

Alright, now I’d say this is an unnecessary limitation! You can work around it by leaving a trailing slash at the end of the user’s home directory, i.e.:

Instead of:

subftp-user1@sub1.domain.tld:x:1002:1002::/home/domain.tld/domains/sub1.domain.tld:/bin/false

Do:

subftp-user1@sub1.domain.tld:x:1002:1002::/home/domain.tld/domains/sub1.domain.tld/:/bin/false

The can be manually changed in /etc/passwd file.


@Jamie, let’s consider removing this limitation and allowing admins to create FTP users who can navigate starting from the domain’s home directory. This restriction seems unnecessary. The defaults can remain as they are, but the text field should accept an empty value or at least ~/.